def RateLimited(generator, msgs_per_sec):
    for x in generator:
        yield x
        time.sleep(1 / msgs_per_sec)
Wrap an existing generator in a rate limit.
dataset/ETHPy150Open remakeelectric/mqtt-malaria/beem/msgs.py/RateLimited