'Group statistics by key_type. Return a sorted list of Statistic
instances.'

def statistics(self, key_type, cumulative=False):

    grouped = self._group_by(key_type, cumulative)
    statistics = list(grouped.values())
    statistics.sort(reverse=True, key=Statistic._sort_key)
    return statistics
