def _get_user_project_membership(user, project, cache='user'):
 if user.is_anonymous():
  return None
 if (cache == 'user'):
  return user.cached_membership_for_project(project)
 return project.cached_memberships_for_user(user)

def _get_user_project_membership ( user , project , cache = 'user' ) : if user . is_anonymous ( ) : return None if ( cache == 'user' ) : return user . cached_membership_for_project ( project ) return project . cached_memberships_for_user ( user )
cache param determines how memberships are calculated trying to reuse the existing data in cache .