nodes: 0, module; 1, function_definition; 2, function_name:sorted; 3, parameters; 4, block; 5, identifier:self; 6, identifier:attrname; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, comment:# Sort attrs, and build new table with sorted pseudos.; 12, return_statement; 13, identifier:reverse; 14, False; 15, comment:"""
          Sort the table according to the value of attribute attrname.
  
          Return:
              New class:`PseudoTable` object
          """; 16, assignment; 17, pattern_list; 18, identifier:self; 19, block; 20, call; 21, identifier:attrs; 22, list; 23, identifier:i; 24, identifier:pseudo; 25, try_statement; 26, expression_statement; 27, attribute; 28, argument_list; 29, block; 30, except_clause; 31, call; 32, identifier:self; 33, identifier:__class__; 34, list_comprehension; 35, expression_statement; 36, identifier:AttributeError; 37, block; 38, attribute; 39, argument_list; 40, subscript; 41, for_in_clause; 42, assignment; 43, expression_statement; 44, identifier:attrs; 45, identifier:append; 46, tuple; 47, identifier:self; 48, subscript; 49, identifier:a; 50, call; 51, identifier:a; 52, call; 53, assignment; 54, identifier:i; 55, identifier:a; 56, identifier:a; 57, integer:0; 58, identifier:sorted; 59, argument_list; 60, identifier:getattr; 61, argument_list; 62, identifier:a; 63, attribute; 64, identifier:attrs; 65, keyword_argument; 66, keyword_argument; 67, identifier:pseudo; 68, identifier:attrname; 69, identifier:np; 70, identifier:inf; 71, identifier:key; 72, lambda; 73, identifier:reverse; 74, identifier:reverse; 75, lambda_parameters; 76, subscript; 77, identifier:t; 78, identifier:t; 79, integer:1
code: def sorted(self, attrname, reverse=False):
          """
          Sort the table according to the value of attribute attrname.
  
          Return:
              New class:`PseudoTable` object
          """
          attrs = []
          for i, pseudo in self:
              try:
                  a = getattr(pseudo, attrname)
              except AttributeError:
                  a = np.inf
              attrs.append((i, a))
  
          # Sort attrs, and build new table with sorted pseudos.
          return self.__class__([self[a[0]] for a in sorted(attrs, key=lambda t: t[1], reverse=reverse)])