import asyncio


def create_task(coro, *, name=None):
    """create_task that supports Python 3.6."""
    if hasattr(asyncio, "create_task"):
        task = asyncio.create_task(coro)
        if name is not None and hasattr(task, "set_name"):
            task.set_name(name)
        return task
    else:
        return asyncio.ensure_future(coro)