def get_user_objects(current_user, user):
 objects = dict(USER_OBJECTS)
 for key in objects:
  if hasattr(user, key):
   manager = getattr(user, key)
   try:
    manager = manager.filter(status__hidden=False)
   except:
    pass
   objects[key]['objects'] = Object.filter_permitted(current_user, manager)
 return objects

def get_user_objects ( current_user , user ) : objects = dict ( USER_OBJECTS ) for key in objects : if hasattr ( user , key ) : manager = getattr ( user , key ) try : manager = manager . filter ( status__hidden = False ) except : pass objects [ key ] [ 'objects' ] = Object . filter_permitted ( current_user , manager ) return objects
returns a dictionary with keys specified as contact attributes and values as dictionaries with labels and set of relevant objects .