Python generator rate limiter using token bucket