def main():
# execute come synchronous code
task1 = aio.create_task(coro1())
result = await task1
task2 = aio.create_task(coro2())
task3 = aio.create_task(coro3())
task4 = aio.create_task(coro4())
# read smth from socket
try:
await aio.wait_for(task2, timeout=0.5)
except aio.TimeoutError:
# handle timeout
await asyncio.gather(task3, task4,
return_exceptions=True)