async def yield_n(n, delay=0.01):
    """Yield n items with a delay between each"""
    for i in range(n):
        if delay:
            await asyncio.sleep(delay)
        yield i
Yield n items with a delay between each
jupyterhub/tests/test_utils.py