def list_groups(refresh=False):
 if (('group.list_groups' in __context__) and (not refresh)):
  return __context__['group.getent']
 ret = []
 pythoncom.CoInitialize()
 nt = win32com.client.Dispatch('AdsNameSpaces')
 results = nt.GetObject('', 'WinNT://.')
 results.Filter = ['group']
 for result in results:
  ret.append(result.name)
 __context__['group.list_groups'] = ret
 return ret

def list_groups ( refresh = False ) : if ( ( 'group.list_groups' in __context__ ) and ( not refresh ) ) : return __context__ [ 'group.getent' ] ret = [ ] pythoncom . CoInitialize ( ) nt = win32com . client . Dispatch ( 'AdsNameSpaces' ) results = nt . GetObject ( '' , 'WinNT://.' ) results . Filter = [ 'group' ] for result in results : ret . append ( result . name ) __context__ [ 'group.list_groups' ] = ret return ret
return a list of groups the named user belongs to .