def decode_from_s3(string, errors='replace'):
 if (type(string) == unicode):
  return string
 try:
  return unicode(string, 'UTF-8', errors)
 except UnicodeDecodeError:
  raise UnicodeDecodeError(('Conversion to unicode failed: %r' % string))

def decode_from_s3 ( string , errors = 'replace' ) : if ( type ( string ) == unicode ) : return string try : return unicode ( string , 'UTF-8' , errors ) except UnicodeDecodeError : raise UnicodeDecodeError ( ( 'Conversion to unicode failed: %r' % string ) )
convert s3 utf-8 string to unicode or raise an exception .