#NEWLINE# def get_memberships( self ) : #NEWLINE# #INDENT# 'Fetches all group memberships.\n\n        Returns:\n            dict:\n        key: group name\n        value: (array of users, array of groups)\n        ' #NEWLINE# response = self . _get_xml ( ( self . rest_url + '/group/membership' ) ) #NEWLINE# if ( not response . ok ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# xmltree = etree . fromstring ( response . content ) #NEWLINE# memberships = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for mg in xmltree . findall ( 'membership' ) : #NEWLINE# #INDENT# group = '{}' . format ( mg . get ( 'group' ) ) #NEWLINE# users = [ '{}' . format ( u . get ( 'name' ) ) for u in mg . find ( 'users' ) . findall ( 'user' ) ] #NEWLINE# groups = [ '{}' . format ( g . get ( 'name' ) ) for g in mg . find ( 'groups' ) . findall ( 'group' ) ] #NEWLINE# memberships [ group ] = { #NEWLINE# #INDENT# 'users' : users , #NEWLINE# 'groups' : groups , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# return group