def ioloop_running(loop):
    """Returns whether the Tornado ioloop is running on not"""
    if hasattr(loop, '_running'):
        return loop._running
    if hasattr(loop, 'asyncio_loop'):
        return loop.asyncio_loop.is_running()
    raise NotImplementedError('Cannot determine tornado.ioloop is running')
