nodes: 0, module; 1, function_definition; 2, function_name:match_key; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, generic_type; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, identifier:Tuple; 13, type_parameter; 14, comment:"""A Key to sort the rules by weight for matching.
  
          The key leads to ordering:
  
           - By first order by defaults as they are simple rules without
             conversions.
           - Then on the complexity of the rule, i.e. does it have any
             converted parts. This is as simple rules are quick to match
             or reject.
           - Then by the number of parts, with more complex (more parts)
             first.
           - Finally by the weights themselves. Note that weights are also
             sub keyed by converter first then weight second.
          """; 15, comparison_operator:self.map is None; 16, block; 17, assignment; 18, tuple; 19, type; 20, type; 21, type; 22, type; 23, attribute; 24, None; 25, raise_statement; 26, identifier:complex_rule; 27, call; 28, not_operator; 29, identifier:complex_rule; 30, unary_operator; 31, attribute; 32, identifier:bool; 33, identifier:bool; 34, identifier:int; 35, generic_type; 36, identifier:self; 37, identifier:map; 38, call; 39, identifier:any; 40, generator_expression; 41, call; 42, call; 43, identifier:self; 44, identifier:_weights; 45, identifier:List; 46, type_parameter; 47, identifier:RuntimeError; 48, argument_list; 49, attribute; 50, for_in_clause; 51, identifier:bool; 52, argument_list; 53, identifier:len; 54, argument_list; 55, type; 56, string:f"{self!r} is not bound to a Map"; 57, identifier:weight; 58, identifier:converter; 59, identifier:weight; 60, attribute; 61, attribute; 62, attribute; 63, identifier:WeightedPart; 64, identifier:self; 65, identifier:_weights; 66, identifier:self; 67, identifier:defaults; 68, identifier:self; 69, identifier:_weights
code: def match_key(self) -> Tuple[bool, bool, int, List[WeightedPart]]:
          """A Key to sort the rules by weight for matching.
  
          The key leads to ordering:
  
           - By first order by defaults as they are simple rules without
             conversions.
           - Then on the complexity of the rule, i.e. does it have any
             converted parts. This is as simple rules are quick to match
             or reject.
           - Then by the number of parts, with more complex (more parts)
             first.
           - Finally by the weights themselves. Note that weights are also
             sub keyed by converter first then weight second.
          """
          if self.map is None:
              raise RuntimeError(f"{self!r} is not bound to a Map")
          complex_rule = any(weight.converter for weight in self._weights)
          return (not bool(self.defaults), complex_rule, -len(self._weights), self._weights)