def es_analyzer_for_locale(locale, synonyms=False, fallback='standard'):
 if (locale in settings.ES_LOCALE_ANALYZERS):
  analyzer = settings.ES_LOCALE_ANALYZERS[locale]
  if (synonyms and (locale in config.ES_SYNONYM_LOCALES)):
   analyzer += '-synonyms'
 else:
  analyzer = fallback
 if ((not settings.ES_USE_PLUGINS) and (analyzer in settings.ES_PLUGIN_ANALYZERS)):
  analyzer = fallback
 return analyzer

def es_analyzer_for_locale ( locale , synonyms = False , fallback = 'standard' ) : if ( locale in settings . ES_LOCALE_ANALYZERS ) : analyzer = settings . ES_LOCALE_ANALYZERS [ locale ] if ( synonyms and ( locale in config . ES_SYNONYM_LOCALES ) ) : analyzer += '-synonyms' else : analyzer = fallback if ( ( not settings . ES_USE_PLUGINS ) and ( analyzer in settings . ES_PLUGIN_ANALYZERS ) ) : analyzer = fallback return analyzer
pick an appropriate analyzer for a given locale .