code: def assert_header_parsing(headers):
      
  
      # This will fail silently if we pass in the wrong kind of parameter.
      # To make debugging easier add an explicit check.
      if not isinstance(headers, httplib.HTTPMessage):
          raise TypeError('expected httplib.Message, got {0}.'.format(
              type(headers)))
  
      defects = getattr(headers, 'defects', None)
      get_payload = getattr(headers, 'get_payload', None)
  
      unparsed_data = None
      if get_payload:
          # get_payload is actually email.message.Message.get_payload;
          # we're only interested in the result if it's not a multipart message
          if not headers.is_multipart():
              payload = get_payload()
  
              if isinstance(payload, (bytes, str)):
                  unparsed_data = payload
  
      if defects or unparsed_data:
          raise HeaderParsingError(defects=defects, unparsed_data=unparsed_data)
docs: Asserts whether all headers have been successfully parsed.
      Extracts encountered errors from the result of parsing headers.
  
      Only works on Python 3.
  
      :param headers: Headers to verify.
      :type headers: `httplib.HTTPMessage`.
  
      :raises urllib3.exceptions.HeaderParsingError:
          If parsing errors are found.