nodes: 0, module; 1, function_definition; 2, function_name:sort_string_by_pairs; 3, parameters; 4, block; 5, identifier:strings; 6, expression_statement; 7, assert_statement; 8, expression_statement; 9, expression_statement; 10, comment:# This shallow copies the list; 11, while_statement; 12, return_statement; 13, comment:"""Group a list of strings by pairs, by matching those with only
      one character difference between each other together."""; 14, comparison_operator:len(strings) % 2 == 0; 15, assignment; 16, assignment; 17, identifier:strings; 18, block; 19, identifier:pairs; 20, binary_operator:len(strings) % 2; 21, integer:0; 22, identifier:pairs; 23, list; 24, identifier:strings; 25, call; 26, expression_statement; 27, for_statement; 28, call; 29, integer:2; 30, identifier:list; 31, argument_list; 32, assignment; 33, pattern_list; 34, call; 35, block; 36, identifier:len; 37, argument_list; 38, identifier:strings; 39, identifier:template; 40, call; 41, identifier:i; 42, identifier:candidate; 43, identifier:enumerate; 44, argument_list; 45, if_statement; 46, identifier:strings; 47, attribute; 48, argument_list; 49, identifier:strings; 50, comparison_operator:count_string_diff(template, candidate) == 1; 51, block; 52, identifier:strings; 53, identifier:pop; 54, call; 55, integer:1; 56, expression_statement; 57, expression_statement; 58, expression_statement; 59, break_statement; 60, identifier:count_string_diff; 61, argument_list; 62, assignment; 63, call; 64, call; 65, identifier:template; 66, identifier:candidate; 67, identifier:pair; 68, list; 69, attribute; 70, argument_list; 71, attribute; 72, argument_list; 73, identifier:template; 74, call; 75, identifier:pair; 76, identifier:sort; 77, identifier:pairs; 78, identifier:append; 79, identifier:pair; 80, attribute; 81, argument_list; 82, identifier:strings; 83, identifier:pop; 84, identifier:i
code: def sort_string_by_pairs(strings):
      """Group a list of strings by pairs, by matching those with only
      one character difference between each other together."""
      assert len(strings) % 2 == 0
      pairs = []
      strings = list(strings) # This shallow copies the list
      while strings:
          template = strings.pop()
          for i, candidate in enumerate(strings):
              if count_string_diff(template, candidate) == 1:
                  pair = [template, strings.pop(i)]
                  pair.sort()
                  pairs.append(pair)
                  break
      return pairs