docs: def parse_mime_type(mime_type):
      """Parses a mime-type into its component parts.
  
      Carves up a mime-type and returns a tuple of the (type, subtype, params)
      where 'params' is a dictionary of all the parameters for the media range.
      For example, the media range 'application/xhtml;q=0.5' would get parsed
      into:
  
         ('application', 'xhtml', {'q', '0.5'})
  
      :rtype: (str,str,dict)
      """
      full_type, params = cgi.parse_header(mime_type)
      # Java URLConnection class sends an Accept header that includes a
      # single '*'. Turn it into a legal wildcard.
      if full_type == '*':
          full_type = '*/*'
  
      type_parts = full_type.split('/') if '/' in full_type else None
      if not type_parts or len(type_parts) > 2:
          raise MimeTypeParseException(
              "Can't parse type \"{}\"".format(full_type))
  
      (type, subtype) = type_parts
  
      return (type.strip(), subtype.strip(), params)