def _can_set_locale(lc):
 try:
  with set_locale(lc):
   pass
 except locale.Error:
  return False
 else:
  return True

def _can_set_locale ( lc ) : try : with set_locale ( lc ) : pass except locale . Error : return False else : return True
check to see if we can set a locale without throwing an exception .