import asyncio


async def wait_for_task(task):
    """Async wrapper to wait for a synchronous task.

    Does what is says on the tin, is a work around used to allow for
    asynchronous methods to wait on synchronous without blocking.

    Args:
        task: (:obj:`Task`): The celery task to wait on.
    """
    while True:
        if task.ready():
            return task.result
        else:
            await asyncio.sleep(1)