def fitness_and_quality_parsed(mime_type, parsed_ranges):
best_fitness = -<NUM_LIT:1> <EOL>best_fit_q = <NUM_LIT:0><EOL>(target_type, target_subtype, target_params) =parse_media_range(mime_type)<EOL>for (type, subtype, params) in parsed_ranges:<EOL><INDENT>if (type == target_type or type == '<STR_LIT:*>' or target_type == '<STR_LIT:*>') and(subtype == target_subtype or subtype == '<STR_LIT:*>' or target_subtype == '<STR_LIT:*>'):<EOL><INDENT>param_matches = reduce(lambda x, y: x+y, [<NUM_LIT:1> for (key, value) inlist(target_params.items()) if key != '<STR_LIT:q>' andkey in params and value == params[key]], <NUM_LIT:0>)<EOL>fitness = (type == target_type) and <NUM_LIT:100> or <NUM_LIT:0><EOL>fitness += (subtype == target_subtype) and <NUM_LIT:10> or <NUM_LIT:0><EOL>fitness += param_matches<EOL>if fitness > best_fitness:<EOL><INDENT>best_fitness = fitness<EOL>best_fit_q = params['<STR_LIT:q>']<EOL><DEDENT><DEDENT><DEDENT>return float(best_fit_q), best_fitness<EOL>
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.