code: def decode_header(header, normalize=False):
      
      # some mailers send out incorrectly escaped headers
      # and double quote the escaped realname part again. remove those
      # RFC: 2047
      regex = r'"(=\?.+?\?.+?\?[^ ?]+\?=)"'
      value = re.sub(regex, r'\1', header)
      logging.debug("unquoted header: |%s|", value)
  
      # otherwise we interpret RFC2822 encoding escape sequences
      valuelist = email.header.decode_header(value)
      decoded_list = []
      for v, enc in valuelist:
          v = string_decode(v, enc)
          decoded_list.append(string_sanitize(v))
      value = ''.join(decoded_list)
      if normalize:
          value = re.sub(r'\n\s+', r' ', value)
      return value
docs: decode a header value to a unicode string
  
      values are usually a mixture of different substrings
      encoded in quoted printable using different encodings.
      This turns it into a single unicode string
  
      :param header: the header value
      :type header: str
      :param normalize: replace trailing spaces after newlines
      :type normalize: bool
      :rtype: str