<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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