nodes: 0, module; 1, function_definition; 2, function_name:sort_by; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, identifier:sort_dir; 12, string; 13, comment:"""Sort by a given variable."""; 14, call; 15, call; 16, string_content:asc; 17, attribute; 18, argument_list; 19, attribute; 20, argument_list; 21, identifier:logger; 22, identifier:log; 23, integer:5; 24, string:"Sort by `%s` %s."; 25, identifier:name; 26, identifier:sort_dir; 27, identifier:self; 28, identifier:eval_js; 29, call; 30, attribute; 31, argument_list; 32, string:'table.sortBy("{}", "{}");'; 33, identifier:format; 34, identifier:name; 35, identifier:sort_dir
code: def sort_by(self, name, sort_dir='asc'):
          """Sort by a given variable."""
          logger.log(5, "Sort by `%s` %s.", name, sort_dir)
          self.eval_js('table.sortBy("{}", "{}");'.format(name, sort_dir))