code: async def _async_main(example_coroutine, client, args):
      
      # Spawn a task for hangups to run in parallel with the example coroutine.
      task = asyncio.ensure_future(client.connect())
  
      # Wait for hangups to either finish connecting or raise an exception.
      on_connect = asyncio.Future()
      client.on_connect.add_observer(lambda: on_connect.set_result(None))
      done, _ = await asyncio.wait(
          (on_connect, task), return_when=asyncio.FIRST_COMPLETED
      )
      await asyncio.gather(*done)
  
      # Run the example coroutine. Afterwards, disconnect hangups gracefully and
      # yield the hangups task to handle any exceptions.
      try:
          await example_coroutine(client, args)
      except asyncio.CancelledError:
          pass
      finally:
          await client.disconnect()
          await task
docs: Run the example coroutine.