def METHOD_NAME(user, gid):
    """
    Function will initialize the supplementary group access list
    for given user. It will gather groups only provided by sssd.
    Arguments are the same as for C function initgroups
    @param string user name of user
    @param int gid the additional gid will be also added to the list.
    @return (int, int, List[int]) (err, errno, gids)
        gids should contain user group IDs if err is NssReturnCode.SUCCESS
        otherwise errno will contain non-zero value.
    """
    func = nss_sss_ctypes_loader('_nss_sss_initgroups_dyn')
    func.restype = c_int
    func.argtypes = [POINTER(c_char), c_uint32, POINTER(c_long),
                     POINTER(c_long), POINTER(POINTER(c_uint32)), c_long,
                     POINTER(c_int)]
    start = POINTER(c_long)(c_long(0))
    size = POINTER(c_long)(c_long(0))
    groups = POINTER(c_uint32)()
    p_groups = pointer(groups)
    limit = c_long(-1)
    errno = POINTER(c_int)(c_int(0))
    res = func(c_char_p(user.encode('utf-8)')), c_uint32(gid), start, size,
               p_groups, limit, errno)
    gids = []
    if res == NssReturnCode.SUCCESS:
        gids_count = size[0]
        assert gids_count > 0, "_nss_sss_initgroups_dyn should return " \
                               "one gid"
        for i in range(0, gids_count):
            gids.append(int(p_groups.contents[i]))
        # add primary group if missing
        if gid not in gids:
            gids.append(gid)
    return (int(res), errno[0], gids)