#NEWLINE# def decode_TEXT( value ) : #NEWLINE# #INDENT# 'Decode :rfc:`2047` TEXT (e.g. "=?utf-8?q?f=C3=BCr?=" -> "f\\xfcr").' #NEWLINE# try : #NEWLINE# #INDENT# from email.header import decode_header #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# from email.Header import decode_header #NEWLINE# #UNINDENT# atoms = decode_header ( value ) #NEWLINE# decodedvalue = '' #NEWLINE# for ( atom , charset ) in atoms : #NEWLINE# #INDENT# if ( charset is not None ) : #NEWLINE# #INDENT# atom = atom . decode ( charset ) #NEWLINE# #UNINDENT# decodedvalue += atom #NEWLINE# #UNINDENT# return decodedvalue