nodes: 0, module; 1, function_definition; 2, function_name:newest; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, return_statement; 10, comment:""" Gets the newest entry in the view, regardless of sort order """; 11, comparison_operator:self._order_by == 'newest'; 12, block; 13, comparison_operator:self._order_by == 'oldest'; 14, block; 15, call; 16, attribute; 17, string; 18, return_statement; 19, attribute; 20, string; 21, return_statement; 22, identifier:max; 23, argument_list; 24, identifier:self; 25, identifier:_order_by; 26, string_content:newest; 27, attribute; 28, identifier:self; 29, identifier:_order_by; 30, string_content:oldest; 31, attribute; 32, attribute; 33, keyword_argument; 34, identifier:self; 35, identifier:first; 36, identifier:self; 37, identifier:last; 38, identifier:self; 39, identifier:entries; 40, identifier:key; 41, lambda; 42, lambda_parameters; 43, tuple; 44, identifier:x; 45, attribute; 46, attribute; 47, identifier:x; 48, identifier:date; 49, identifier:x; 50, identifier:id
code: def newest(self):
          """ Gets the newest entry in the view, regardless of sort order """
          if self._order_by == 'newest':
              return self.first
          if self._order_by == 'oldest':
              return self.last
          return max(self.entries, key=lambda x: (x.date, x.id))