nodes: 0, module; 1, function_definition; 2, function_name:_sort_kw_matches; 3, parameters; 4, block; 5, identifier:skw_matches; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:limit; 12, integer:0; 13, comment:"""Return a resized version of keywords to the given length."""; 14, assignment; 15, call; 16, boolean_operator; 17, identifier:sorted_keywords; 18, call; 19, identifier:sorted; 20, argument_list; 21, boolean_operator; 22, identifier:sorted_keywords; 23, identifier:list; 24, argument_list; 25, identifier:sorted_keywords; 26, keyword_argument; 27, identifier:limit; 28, subscript; 29, call; 30, identifier:key; 31, call; 32, identifier:sorted_keywords; 33, slice; 34, attribute; 35, argument_list; 36, identifier:cmp_to_key; 37, argument_list; 38, identifier:limit; 39, identifier:skw_matches; 40, identifier:items; 41, identifier:_skw_matches_comparator
code: def _sort_kw_matches(skw_matches, limit=0):
      """Return a resized version of keywords to the given length."""
      sorted_keywords = list(skw_matches.items())
      sorted(sorted_keywords, key=cmp_to_key(_skw_matches_comparator))
      return limit and sorted_keywords[:limit] or sorted_keywords