def _decode_preferred_encoding(s):
 enc = locale.getpreferredencoding()
 try:
  try:
   return s.decode(enc)
  except LookupError:
   enc = _DEFAULT_ENCODING
  return s.decode(enc)
 except UnicodeDecodeError:
  return s.decode(u'latin-1')

def _decode_preferred_encoding ( s ) : enc = locale . getpreferredencoding ( ) try : try : return s . decode ( enc ) except LookupError : enc = _DEFAULT_ENCODING return s . decode ( enc ) except UnicodeDecodeError : return s . decode ( u'latin-1' )
decode the supplied byte string using the preferred encoding for the locale or .