def nl_socket_drop_memberships(sk, *group):
if sk.s_fd == -<NUM_LIT:1>:<EOL><INDENT>return -NLE_BAD_SOCK<EOL><DEDENT>for grp in group:<EOL><INDENT>if not grp:<EOL><INDENT>break<EOL><DEDENT>if grp < <NUM_LIT:0>:<EOL><INDENT>return -NLE_INVAL<EOL><DEDENT>try:<EOL><INDENT>sk.socket_instance.setsockopt(SOL_NETLINK, NETLINK_DROP_MEMBERSHIP, grp)<EOL><DEDENT>except OSError as exc:<EOL><INDENT>return -nl_syserr2nlerr(exc.errno)<EOL><DEDENT><DEDENT>return <NUM_LIT:0><EOL>
Leave groups.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L465

    Leaves the specified groups using the modern socket option. The list of groups has to terminated by 0.

    Positional arguments:
    sk -- Netlink socket (nl_sock class instance).
    group -- group identifier (integer).

    Returns:
    0 on success or a negative error code.