code: def extract_headers(mail, headers=None):
      
      headertext = u''
      if headers is None:
          headers = mail.keys()
      for key in headers:
          value = u''
          if key in mail:
              value = decode_header(mail.get(key, ''))
          headertext += '%s: %s\n' % (key, value)
      return headertext
docs: returns subset of this messages headers as human-readable format:
      all header values are decoded, the resulting string has
      one line "KEY: VALUE" for each requested header present in the mail.
  
      :param mail: the mail to use
      :type mail: :class:`email.Message`
      :param headers: headers to extract
      :type headers: list of str