def _valid_locales(locales, normalize):
 if normalize:
  normalizer = (lambda x: locale.normalize(x.strip()))
 else:
  normalizer = (lambda x: x.strip())
 return list(filter(_can_set_locale, map(normalizer, locales)))

def _valid_locales ( locales , normalize ) : if normalize : normalizer = ( lambda x : locale . normalize ( x . strip ( ) ) ) else : normalizer = ( lambda x : x . strip ( ) ) return list ( filter ( _can_set_locale , map ( normalizer , locales ) ) )
return a list of normalized locales that do not throw an exception when set .