I think you could merge the two `if` statements into one:

    if (lang_code not in supported and lang_code in deprecated_locales and
            deprecated_locales[lang_code] in supported):
        return deprecated_locales[lang_code]