def get_project_translation(request, project=None, subproject=None, lang=None):
 if ((lang is not None) and (subproject is not None)):
  translation = get_translation(request, project, subproject, lang)
  subproject = translation.subproject
  project = subproject.project
 else:
  translation = None
  if (subproject is not None):
   subproject = get_subproject(request, project, subproject)
   project = subproject.project
  elif (project is not None):
   project = get_project(request, project)
 return (project, subproject, translation)

def get_project_translation ( request , project = None , subproject = None , lang = None ) : if ( ( lang is not None ) and ( subproject is not None ) ) : translation = get_translation ( request , project , subproject , lang ) subproject = translation . subproject project = subproject . project else : translation = None if ( subproject is not None ) : subproject = get_subproject ( request , project , subproject ) project = subproject . project elif ( project is not None ) : project = get_project ( request , project ) return ( project , subproject , translation )
returns project .