docs: def quality_and_fitness_parsed(mime_type, parsed_ranges):
      """Find the best match for a mime-type amongst parsed media-ranges.
  
      Find the best match for a given mime-type against a list of media_ranges
      that have already been parsed by parse_media_range(). Returns a tuple of
      the fitness value and the value of the 'q' quality parameter of the best
      match, or (-1, 0) if no match was found. Just as for quality_parsed(),
      'parsed_ranges' must be a list of parsed media ranges.
  
      :rtype: (float,int)
      """
      best_fitness = -1
      best_fit_q = 0
      (target_type, target_subtype, target_params) = \
          parse_media_range(mime_type)
  
      for (type, subtype, params) in parsed_ranges:
  
          # check if the type and the subtype match
          type_match = (
              type in (target_type, '*') or
              target_type == '*'
          )
          subtype_match = (
              subtype in (target_subtype, '*') or
              target_subtype == '*'
          )
  
          # if they do, assess the "fitness" of this mime_type
          if type_match and subtype_match:
  
              # 100 points if the type matches w/o a wildcard
              fitness = type == target_type and 100 or 0
  
              # 10 points if the subtype matches w/o a wildcard
              fitness += subtype == target_subtype and 10 or 0
  
              # 1 bonus point for each matching param besides "q"
              param_matches = sum([
                  1 for (key, value) in target_params.items()
                  if key != 'q' and key in params and value == params[key]
              ])
              fitness += param_matches
  
              # finally, add the target's "q" param (between 0 and 1)
              fitness += float(target_params.get('q', 1))
  
              if fitness > best_fitness:
                  best_fitness = fitness
                  best_fit_q = params['q']
  
      return float(best_fit_q), best_fitness