def valid_locale(value):
    if not value:
        return

    if value not in settings.SUMO_LANGUAGES:
        if value in settings.NON_SUPPORTED_LOCALES:
            fallback = settings.NON_SUPPORTED_LOCALES[value] or settings.WIKI_DEFAULT_LANGUAGE
            raise serializers.ValidationError(
                '"{0}" is not supported, but has fallback locale "{1}".'.format(
                    value, fallback))
        else:
            raise serializers.ValidationError(
                'Could not find locale "{0}".'.format(value)
            )
dataset/ETHPy150Open mozilla/kitsune/kitsune/search/api.py/valid_locale/original