import asyncio


def asyncio_run(tasks):
    """
      Helper method which abstracts differences from
      Python 3.7 and before about coroutines
    """
    if hasattr(asyncio, "run"):
        done , _ = asyncio.run(asyncio.wait(tasks))
    else:
        loop = asyncio.new_event_loop()
        try:
            done, _ = loop.run_until_complete(asyncio.wait(tasks))
        finally:
            loop.close()

    task = done.pop()
    retval_exception = task.exception()
    
    if retval_exception is not None:
        raise retval_exception
        
    return task.result()