def check_if_project_is_out_of_owner_limits(project, current_memberships=None, current_private_projects=None, current_public_projects=None):
 if (project.owner is None):
  return {'can_be_updated': False, 'reason': ERROR_PROJECT_WITHOUT_OWNER}
 if (current_memberships is None):
  current_memberships = project.memberships.count()
 if project.is_private:
  max_memberships = project.owner.max_memberships_private_projects
  if (current_private_projects is None):
   current_projects = project.owner.owned_projects.filter(is_private=True).count()
  else:
   current_projects = current_private_projects
  max_projects = project.owner.max_private_projects
 else:
  max_memberships = project.owner.max_memberships_public_projects
  if (current_public_projects is None):
   current_projects = project.owner.owned_projects.filter(is_private=False).count()
  else:
   current_projects = current_public_projects
  max_projects = project.owner.max_public_projects
 if ((max_memberships is not None) and (current_memberships > max_memberships)):
  return True
 if ((max_projects is not None) and (current_projects > max_projects)):
  return True
 return False

def check_if_project_is_out_of_owner_limits ( project , current_memberships = None , current_private_projects = None , current_public_projects = None ) : if ( project . owner is None ) : return { 'can_be_updated' : False , 'reason' : ERROR_PROJECT_WITHOUT_OWNER } if ( current_memberships is None ) : current_memberships = project . memberships . count ( ) if project . is_private : max_memberships = project . owner . max_memberships_private_projects if ( current_private_projects is None ) : current_projects = project . owner . owned_projects . filter ( is_private = True ) . count ( ) else : current_projects = current_private_projects max_projects = project . owner . max_private_projects else : max_memberships = project . owner . max_memberships_public_projects if ( current_public_projects is None ) : current_projects = project . owner . owned_projects . filter ( is_private = False ) . count ( ) else : current_projects = current_public_projects max_projects = project . owner . max_public_projects if ( ( max_memberships is not None ) and ( current_memberships > max_memberships ) ) : return True if ( ( max_projects is not None ) and ( current_projects > max_projects ) ) : return True return False
return if the project fits on its owner limits .