def exit(loop):
try:
loop.run_until_complete(asyncio.wait( \
list(asyncio.Task.all_tasks()),
return_when=futures.ALL_COMPLETED))
loop.close()
except KeyboardInterrupt:
pass