def get_stats_for_scope(self, quota_name, scope, dates):
        stats_data = []
        try:
            quota = scope.quotas.get(name=quota_name)
        except Quota.DoesNotExist:
            return stats_data
        versions = reversion\
            .get_for_object(quota)\
            .select_related('revision')\
            .filter(revision__date_created__lte=dates[0][0])\
            .iterator()
        version = None
        for end, start in dates:
            try:
                while version is None or version.revision.date_created > end:
                    version = versions.next()
                stats_data.append((version.object_version.object.limit,
                                   version.object_version.object.usage))
            except __HOLE__:
                break

        return stats_data
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/structure/views.py/QuotaTimelineStatsView.get_stats_for_scope