<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def top_pages_by_time_period(self, interval='day'):
 """ Get a breakdown of top pages per interval, i.e. day url count 2014-01-01 /blog/ 11 2014-01-02 /blog/ 14 2014-01-03 /blog/ 9 """

        date_trunc = fn.date_trunc(interval, PageView.timestamp)
        return (self.get_query()
                .select(
                    PageView.url,
                    date_trunc.alias(interval),
                    fn.Count(PageView.id).alias('count'))
                .group_by(PageView.url, date_trunc)
                .order_by(
                    SQL(interval),
                    SQL('count').desc(),
                    PageView.url))