nodes: 0, module; 1, function_definition; 2, function_name:user_agents; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""
          Retrieve user-agents, sorted by most common to least common.
          """; 9, parenthesized_expression; 10, call; 11, attribute; 12, argument_list; 13, call; 14, identifier:tuples; 15, attribute; 16, argument_list; 17, call; 18, identifier:order_by; 19, call; 20, attribute; 21, argument_list; 22, attribute; 23, argument_list; 24, call; 25, identifier:group_by; 26, subscript; 27, call; 28, identifier:desc; 29, attribute; 30, argument_list; 31, attribute; 32, string; 33, attribute; 34, argument_list; 35, call; 36, identifier:select; 37, subscript; 38, call; 39, identifier:PageView; 40, identifier:headers; 41, string_content:User-Agent; 42, identifier:fn; 43, identifier:Count; 44, attribute; 45, attribute; 46, argument_list; 47, attribute; 48, string; 49, attribute; 50, argument_list; 51, identifier:PageView; 52, identifier:id; 53, identifier:self; 54, identifier:get_query; 55, identifier:PageView; 56, identifier:headers; 57, string_content:User-Agent; 58, identifier:fn; 59, identifier:Count; 60, attribute; 61, identifier:PageView; 62, identifier:id
code: def user_agents(self):
          """
          Retrieve user-agents, sorted by most common to least common.
          """
          return (self.get_query()
                  .select(
                      PageView.headers['User-Agent'],
                      fn.Count(PageView.id))
                  .group_by(PageView.headers['User-Agent'])
                  .order_by(fn.Count(PageView.id).desc())
                  .tuples())