def _translate_page_into(page, language, default=None):
 try:
  if (page.language == language):
   return page
  if (language is not None):
   translations = dict(((t.language, t) for t in page.available_translations()))
   if (language in translations):
    return translations[language]
 except AttributeError:
  pass
 if hasattr(default, u'__call__'):
  return default(page=page)
 return default

def _translate_page_into ( page , language , default = None ) : try : if ( page . language == language ) : return page if ( language is not None ) : translations = dict ( ( ( t . language , t ) for t in page . available_translations ( ) ) ) if ( language in translations ) : return translations [ language ] except AttributeError : pass if hasattr ( default , u'__call__' ) : return default ( page = page ) return default
return the translation for a given page .