nodes: 0, module; 1, function_definition; 2, function_name:get_top; 3, parameters; 4, block; 5, identifier:self; 6, identifier:stat; 7, identifier:n; 8, expression_statement; 9, return_statement; 10, comment:"""Return the top n values when sorting by 'stat'"""; 11, subscript; 12, call; 13, slice; 14, identifier:sorted; 15, argument_list; 16, identifier:n; 17, attribute; 18, keyword_argument; 19, keyword_argument; 20, identifier:self; 21, identifier:stats; 22, identifier:key; 23, lambda; 24, identifier:reverse; 25, True; 26, lambda_parameters; 27, call; 28, identifier:x; 29, identifier:getattr; 30, argument_list; 31, identifier:x; 32, identifier:stat
code: def get_top(self, stat, n):
          """Return the top n values when sorting by 'stat'"""
          return sorted(self.stats, key=lambda x: getattr(x, stat), reverse=True)[:n]