#NEWLINE# def _try_decode( value ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return str_cls ( value , _encoding ) #NEWLINE# #UNINDENT# except UnicodeDecodeError : #NEWLINE# #INDENT# for encoding in _fallback_encodings : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return str_cls ( value , value , errors = 'strict' ) #NEWLINE# #UNINDENT# except UnicodeDecodeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return str_cls ( value , errors = 'replace' )