code: def set_exception(self, exception, traceback=None):
          
          if not isinstance(exception, BaseException):
              raise RuntimeError("Exception must be of BaseException type")
          self._exception = exception
          self._traceback = traceback
          self._event.set()
          self._invoke_callbacks()
docs: Sets the exception for this Future in case of errors.
  
          :param exception: (Exception), exception to be threw in case of error.
          :param traceback: (Function), function to be called on traceback (optional).