def _get_stats(self, task, start_date):
        """ Fetches statistic information for given task and start range.
            """

        stats = []
        stats_dir = self._sdir(task.base_dir)
        date = start_date
        end_date = datetime.date.today()
        delta = datetime.timedelta(days=1)

        while date <= end_date:
            date_str = date.strftime('%Y%m%d')
            filename = os.path.join(stats_dir, '{0}.json'.format(date_str))

            if os.path.exists(filename):
                try:
                    # fetch stats content
                    with open(filename, 'r') as file_:
                        data = json.loads(file_.read())

                    # sort descending by time
                    stats.append((date, sorted(data.iteritems(),
                                               key=lambda x: x[1],
                                               reverse=True)))

                except (json.JSONDecodeError, __HOLE__):
                    pass

            date += delta  # next day

        return stats
dataset/ETHPy150Open xtrementl/focus/focus/plugin/modules/stats.py/Stats._get_stats