def valid_locale_fallback(desired_locale=None):
 candidates_windows = [str(u'English'), str(u'C')]
 candidates_posix = [str(u'en_US.UTF-8'), str(u'C')]
 candidates = (candidates_windows if (sys.platform == u'win32') else candidates_posix)
 if desired_locale:
  candidates = list(candidates)
  candidates.insert(0, desired_locale)
 found_valid = False
 for locale_n in candidates:
  found_valid = is_valid_locale(locale_n)
  if found_valid:
   break
 if (not found_valid):
  msg = u'Could not find a valid fallback locale, tried: {0}'
  utils.LOGGER.warn(msg.format(candidates))
 elif (desired_locale and (desired_locale != locale_n)):
  msg = u'Desired fallback locale {0} could not be set, using: {1}'
  utils.LOGGER.warn(msg.format(desired_locale, locale_n))
 return locale_n

def valid_locale_fallback ( desired_locale = None ) : candidates_windows = [ str ( u'English' ) , str ( u'C' ) ] candidates_posix = [ str ( u'en_US.UTF-8' ) , str ( u'C' ) ] candidates = ( candidates_windows if ( sys . platform == u'win32' ) else candidates_posix ) if desired_locale : candidates = list ( candidates ) candidates . insert ( 0 , desired_locale ) found_valid = False for locale_n in candidates : found_valid = is_valid_locale ( locale_n ) if found_valid : break if ( not found_valid ) : msg = u'Could not find a valid fallback locale, tried: {0}' utils . LOGGER . warn ( msg . format ( candidates ) ) elif ( desired_locale and ( desired_locale != locale_n ) ) : msg = u'Desired fallback locale {0} could not be set, using: {1}' utils . LOGGER . warn ( msg . format ( desired_locale , locale_n ) ) return locale_n
provide a default fallback_locale .