A number of unix systems expose a getgroupslist function to fetch the groups that a user is a member of. It would be nice if that function were exposed to python.
See issue7900 for more information on why that would be useful.

I don't see how this difference is relevant for exposing the functionality in python:
Linux:
int getgrouplist(const char *user, gid_t group,
gid_t *groups, int *ngroups);
MacOS:
int
getgrouplist(const char *name, int basegid, int *groups, int *ngroups);
The only difference is that Linux uses gid_t and MacOS uses int. The requested posix.getgrouplist() will take a python string and a python integer and return a list of integers.

Attached is a patch (against the latest revision, 87178) which adds the functionality to the posix module as well as adds a testcase for it.
I haven't added it to the os module, I'm not sure if that should be done.
I tested it on Linux & FreeBSD and it works as expected. Since I don't have an OS X system, I could not test it on there.

Patch looks good, but this likely runs into the same problem as #7900: the user can be a member of more than NGROUPS_MAX on OSX.
I'll test this tomorrow (by creating a temporary user that is a member of more than 16 groups).

Looks good to me as well. Just a nit-pick: in python code base "sizeof" is not separated from the opening parenthesis. I understand the desire to distinguish "sizeof" from a function, but it is probably better to be consistent.