def _translate_page_into(page, language, default=None):
    """
    Return the translation for a given page
    """
    # Optimisation shortcut: No need to dive into translations if page already
    # what we want
    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 __HOLE__:
        pass

    if hasattr(default, '__call__'):
        return default(page=page)
    return default


# ------------------------------------------------------------------------
dataset/ETHPy150Open feincms/feincms/feincms/templatetags/feincms_page_tags.py/_translate_page_into