def get_user_groups(name, sid=False):
 if (name == 'SYSTEM'):
  groups = [name]
 else:
  groups = win32net.NetUserGetLocalGroups(None, name)
 if (not sid):
  return groups
 ret_groups = set()
 for group in groups:
  ret_groups.add(get_sid_from_name(group))
 return ret_groups

def get_user_groups ( name , sid = False ) : if ( name == 'SYSTEM' ) : groups = [ name ] else : groups = win32net . NetUserGetLocalGroups ( None , name ) if ( not sid ) : return groups ret_groups = set ( ) for group in groups : ret_groups . add ( get_sid_from_name ( group ) ) return ret_groups
get the groups to which a user belongs args: name : the user name to query sid : true will return a list of sids .