#NEWLINE# def _decode( s , message ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# e = message . get ( 'Content-Type' ) #NEWLINE# e = e . split ( 'charset=' ) [ ( - 1 ) ] . split ( ';' ) [ 0 ] . strip ( '"\'' ) . lower ( ) #NEWLINE# s = s . decode ( s ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# s = s . decode ( 'utf-8' ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# s = s . decode ( 'latin-1' ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return s