def best_match(supported, header):
parsed_header = [parse_media_range(r) for r in _filter_blank(header.split("<STR_LIT:U+002C>"))]<EOL>weighted_matches = []<EOL>pos = <NUM_LIT:0><EOL>for mime_type in supported:<EOL><INDENT>weighted_matches.append((fitness_and_quality_parsed(mime_type,<EOL>parsed_header), pos, mime_type)) <EOL>pos += <NUM_LIT:1><EOL><DEDENT>weighted_matches.sort()<EOL>return weighted_matches[-<NUM_LIT:1>][<NUM_LIT:0>][<NUM_LIT:0>] and weighted_matches[-<NUM_LIT:1>][<NUM_LIT:2>] or '<STR_LIT>'<EOL>
Takes a list of supported mime-types and finds the best
    match for all the media-ranges listed in header. The value of
    header must be a string that conforms to the format of the 
    HTTP Accept: header. The value of 'supported' is a list of
    mime-types. The list of supported mime-types should be sorted
    in order of increasing desirability, in case of a situation 
    where there is a tie

    >>> best_match(['application/xbel+xml', 'text/xml'], 'text/*;q=0.5,*/*; q=0.1')
    'text/xml'