nodes: 0, module; 1, function_definition; 2, function_name:sort_matches; 3, parameters; 4, block; 5, identifier:matches; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, string; 11, assignment; 12, assignment; 13, list_comprehension; 14, string_content:Sorts a ``list`` of matches best to worst; 15, identifier:multipliers; 16, dictionary; 17, identifier:matches; 18, list_comprehension; 19, subscript; 20, for_in_clause; 21, pair; 22, pair; 23, pair; 24, pair; 25, tuple; 26, for_in_clause; 27, identifier:x; 28, integer:1; 29, identifier:x; 30, call; 31, string; 32, binary_operator:10**5; 33, string; 34, binary_operator:10**4; 35, string; 36, binary_operator:10**2; 37, string; 38, integer:1; 39, binary_operator:multipliers[x.type]*(x.amount if x.amount else 1); 40, identifier:x; 41, identifier:x; 42, identifier:matches; 43, identifier:sorted; 44, argument_list; 45, string_content:exact; 46, integer:10; 47, integer:5; 48, string_content:fname; 49, integer:10; 50, integer:4; 51, string_content:fuzzy; 52, integer:10; 53, integer:2; 54, string_content:fuzzy_fragment; 55, subscript; 56, parenthesized_expression; 57, identifier:matches; 58, keyword_argument; 59, identifier:multipliers; 60, attribute; 61, conditional_expression:x.amount if x.amount else 1; 62, identifier:reverse; 63, True; 64, identifier:x; 65, identifier:type; 66, attribute; 67, attribute; 68, integer:1; 69, identifier:x; 70, identifier:amount; 71, identifier:x; 72, identifier:amount
code: def sort_matches(matches):
      '''Sorts a ``list`` of matches best to worst'''
      multipliers = {'exact':10**5,'fname':10**4,'fuzzy':10**2,'fuzzy_fragment':1}
      matches = [(multipliers[x.type]*(x.amount if x.amount else 1),x) for x in matches]
      return [x[1] for x in sorted(matches,reverse=True)]