docs: def wait(self):
          """Wait on a task to finish and stop it when it has finished.
  
          Raises:
              RuntimeError: If the task hasn't been started or has already been
                  stopped.
  
          Returns:
              The ``return_values`` of the task.
          """
          if self._status is not TaskStatus.STARTED:
              raise RuntimeError("Cannot wait on %s in state %s" %
                                 (self, self._status))
          self._wait()
          self.stop()
          return self.return_values