nodes: 0, module; 1, function_definition; 2, function_name:_sort_column; 3, parameters; 4, block; 5, identifier:self; 6, identifier:column; 7, identifier:reverse; 8, expression_statement; 9, if_statement; 10, comment:# get list of (value, item) tuple where value is the value in column for the item; 11, expression_statement; 12, comment:# sort list using the column type; 13, expression_statement; 14, comment:# reorder items; 15, for_statement; 16, comment:# reverse sorting direction for the next time; 17, expression_statement; 18, comment:"""Sort a column by its values"""; 19, comparison_operator:tk.DISABLED in self.state(); 20, block; 21, assignment; 22, call; 23, pattern_list; 24, call; 25, block; 26, call; 27, attribute; 28, call; 29, return_statement; 30, identifier:l; 31, list_comprehension; 32, attribute; 33, argument_list; 34, identifier:index; 35, tuple_pattern; 36, identifier:enumerate; 37, argument_list; 38, expression_statement; 39, attribute; 40, argument_list; 41, identifier:tk; 42, identifier:DISABLED; 43, attribute; 44, argument_list; 45, tuple; 46, for_in_clause; 47, identifier:l; 48, identifier:sort; 49, keyword_argument; 50, keyword_argument; 51, identifier:val; 52, identifier:child; 53, identifier:l; 54, call; 55, identifier:self; 56, identifier:heading; 57, identifier:column; 58, keyword_argument; 59, identifier:self; 60, identifier:state; 61, call; 62, identifier:child; 63, identifier:child; 64, call; 65, identifier:reverse; 66, identifier:reverse; 67, identifier:key; 68, lambda; 69, attribute; 70, argument_list; 71, identifier:command; 72, lambda; 73, attribute; 74, argument_list; 75, attribute; 76, argument_list; 77, lambda_parameters; 78, call; 79, identifier:self; 80, identifier:move; 81, identifier:child; 82, string:""; 83, identifier:index; 84, call; 85, identifier:self; 86, identifier:set; 87, identifier:child; 88, identifier:column; 89, identifier:self; 90, identifier:get_children; 91, string; 92, identifier:x; 93, subscript; 94, argument_list; 95, attribute; 96, argument_list; 97, attribute; 98, identifier:column; 99, subscript; 100, identifier:self; 101, identifier:_sort_column; 102, identifier:column; 103, not_operator; 104, identifier:self; 105, identifier:_column_types; 106, identifier:x; 107, integer:0; 108, identifier:reverse
code: def _sort_column(self, column, reverse):
          """Sort a column by its values"""
          if tk.DISABLED in self.state():
              return
          # get list of (value, item) tuple where value is the value in column for the item
          l = [(self.set(child, column), child) for child in self.get_children('')]
          # sort list using the column type
          l.sort(reverse=reverse, key=lambda x: self._column_types[column](x[0]))
          # reorder items
          for index, (val, child) in enumerate(l):
              self.move(child, "", index)
          # reverse sorting direction for the next time
          self.heading(column, command=lambda: self._sort_column(column, not reverse))