Implementation of a Redis rate limiter in Python