def encode_to_s3(string, errors='replace'):
 if (type(string) != unicode):
  return str(string)
 try:
  return string.encode('UTF-8', errors)
 except UnicodeEncodeError:
  raise UnicodeEncodeError(('Conversion from unicode failed: %r' % string))

def encode_to_s3 ( string , errors = 'replace' ) : if ( type ( string ) != unicode ) : return str ( string ) try : return string . encode ( 'UTF-8' , errors ) except UnicodeEncodeError : raise UnicodeEncodeError ( ( 'Conversion from unicode failed: %r' % string ) )
convert unicode to s3 utf-8 string .