docs: def parse_media_range(range):
      """Parse a media-range into its component parts.
  
      Carves up a media range 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/*;q=0.5' would get parsed
      into:
  
         ('application', '*', {'q', '0.5'})
  
      In addition this function also guarantees that there is a value for 'q'
      in the params dictionary, filling it in with a proper default if
      necessary.
  
      :rtype: (str,str,dict)
      """
      (type, subtype, params) = parse_mime_type(range)
      params.setdefault('q', params.pop('Q', None))  # q is case insensitive
      try:
          if not params['q'] or not 0 <= float(params['q']) <= 1:
              params['q'] = '1'
      except ValueError:  # from float()
          params['q'] = '1'
  
      return (type, subtype, params)