code: def _done_handler(self, task):
          
          try:
              task.result()
          except asyncio.CancelledError:
              # normal termination
              pass
          except Exception as err:
              try:
                  if self._sm_enabled:
                      self._xmlstream.abort()
                  else:
                      self._xmlstream.close()
              except Exception:
                  pass
              self.on_failure(err)
              self._logger.exception("broker task failed")
docs: Called when the main task (:meth:`_run`, :attr:`_task`) returns.