Returns an active language code that is guaranteed to be in
    settings.SUPPORTED_LANGUAGES.

def get_language():
    """
    Returns an active language code that is guaranteed to be in
    settings.SUPPORTED_LANGUAGES.
    """
    lang = _get_language()

    if not lang:
        return get_fallback_language()

    langs = [l[0] for l in settings.SUPPORTED_LANGUAGES]
    if lang not in langs and "-" in lang:
        lang = lang.split("-")[0]

    if lang in langs:
        return lang

    return settings.DEFAULT_LANGUAGE