def mime_decode(line):
 newline = ''
 pos = 0
 while 1:
  res = mime_code.search(line, pos)
  if (res is None):
   break
  newline = ((newline + line[pos:res.start(0)]) + chr(int(res.group(1), 16)))
  pos = res.end(0)
 return (newline + line[pos:])

def mime_decode ( line ) : newline = '' pos = 0 while 1 : res = mime_code . search ( line , pos ) if ( res is None ) : break newline = ( ( newline + line [ pos : res . start ( 0 ) ] ) + chr ( int ( res . group ( 1 ) , 16 ) ) ) pos = res . end ( 0 ) return ( newline + line [ pos : ] )
decode a single line of quoted-printable text to 8bit .