code: def _parse_header(line: str) -> Tuple[str, Dict[str, str]]:
      r
      parts = _parseparam(";" + line)
      key = next(parts)
      # decode_params treats first argument special, but we already stripped key
      params = [("Dummy", "value")]
      for p in parts:
          i = p.find("=")
          if i >= 0:
              name = p[:i].strip().lower()
              value = p[i + 1 :].strip()
              params.append((name, native_str(value)))
      decoded_params = email.utils.decode_params(params)
      decoded_params.pop(0)  # get rid of the dummy again
      pdict = {}
      for name, decoded_value in decoded_params:
          value = email.utils.collapse_rfc2231_value(decoded_value)
          if len(value) >= 2 and value[0] == '"' and value[-1] == '"':
              value = value[1:-1]
          pdict[name] = value
      return key, pdict
docs: r"""Parse a Content-type like header.
  
      Return the main content-type and a dictionary of options.
  
      >>> d = "form-data; foo=\"b\\\\a\\\"r\"; file*=utf-8''T%C3%A4st"
      >>> ct, d = _parse_header(d)
      >>> ct
      'form-data'
      >>> d['file'] == r'T\u00e4st'.encode('ascii').decode('unicode_escape')
      True
      >>> d['foo']
      'b\\a"r'