def limit(self, func_name, request,
            ip=True, field=None, count=5, period=None):
        """Return limit data about any keys relevant for requst."""
        counters = cache.get_many(
            self._keys(func_name, request, ip, field, period)
        )

        limits = []
        for counter in counters:
            ratelimited_by = 'field'
            if ':ip:' in counter:
                ratelimited_by = 'ip'

            current_count = counters[counter]
            if isinstance(current_count, tuple):
                current_count = current_count[0]

            if current_count > count:
                limits.append({
                    'ratelimited_by': ratelimited_by,
                    'period': period,
                    'field': field,
                    'count': current_count,
                    'cache_key': counter,
                    'ip': self.get_ip(request)
                })

        return limits
dataset/ETHPy150Open gmcquillan/django-brake/brake/backends/cachebe.py/CacheBackend.limit/original