code: async def wait_async(self):
          
          if self.error:
              raise self.error
          if not self.running:
              raise ValueError("Unable to send until client has been started.")
          try:
              await self._handler.wait_async()
          except (errors.TokenExpired, errors.AuthenticationException):
              log.info("AsyncSender disconnected due to token error. Attempting reconnect.")
              await self.reconnect_async()
          except (errors.LinkDetach, errors.ConnectionClose) as shutdown:
              if shutdown.action.retry and self.auto_reconnect:
                  log.info("AsyncSender detached. Attempting reconnect.")
                  await self.reconnect_async()
              else:
                  log.info("AsyncSender detached. Shutting down.")
                  error = EventHubError(str(shutdown), shutdown)
                  await self.close_async(exception=error)
                  raise error
          except errors.MessageHandlerError as shutdown:
              if self.auto_reconnect:
                  log.info("AsyncSender detached. Attempting reconnect.")
                  await self.reconnect_async()
              else:
                  log.info("AsyncSender detached. Shutting down.")
                  error = EventHubError(str(shutdown), shutdown)
                  await self.close_async(exception=error)
                  raise error
          except Exception as e:
              log.info("Unexpected error occurred (%r).", e)
              raise EventHubError("Send failed: {}".format(e))
docs: Wait until all transferred events have been sent.