docs: def parse_mime_type(mime_type):
      """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'})
  
      """
      parts = mime_type.split(";")
      params = dict([tuple([s.strip() for s in param.split("=")]) for param in parts[1:]])
      full_type = parts[0].strip()
      # Java URLConnection class sends an Accept header that includes a single "*"
      # Turn it into a legal wildcard.
      if full_type == '*':
          full_type = '*/*'
      (type, subtype) = full_type.split("/")
      return (type.strip(), subtype.strip(), params)