'Retrieve user-agents, sorted by most common to least common.'

def user_agents(self):

    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()
