parameters: (supported, header)
return_statement: return weighted_matches[-1][0][1] and weighted_matches[-1][2] or ''
docstring: Return mime-type with the highest quality ('q') from list of candidates.
  
      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'
docstring_summary: Return mime-type with the highest quality ('q') from list of candidates.
docstring_tokens: Return mime - type with the highest quality ( q ) from list of candidates .
function: def best_match(supported, header):
      """Return mime-type with the highest quality ('q') from list of candidates.
  
      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'
      """
      split_header = _filter_blank(header.split(','))
      parsed_header = [parse_media_range(r) for r in split_header]
      weighted_matches = []
      pos = 0
      for mime_type in supported:
          weighted_matches.append((fitness_and_quality_parsed(mime_type,
                                   parsed_header), pos, mime_type))
          pos += 1
      weighted_matches.sort()
  
      return weighted_matches[-1][0][1] and weighted_matches[-1][2] or ''
function_tokens: def best_match ( supported , header ) : split_header = _filter_blank ( header . split ( ',' ) ) parsed_header = [ parse_media_range ( r ) for r in split_header ] weighted_matches = [ ] pos = 0 for mime_type in supported : weighted_matches . append ( ( fitness_and_quality_parsed ( mime_type , parsed_header ) , pos , mime_type ) ) pos += 1 weighted_matches . sort ( ) return weighted_matches [ - 1 ] [ 0 ] [ 1 ] and weighted_matches [ - 1 ] [ 2 ] or ''