code: def set_exception(self, exception):
          
          assert isinstance(exception, Exception), \
              "%r should be an Exception" % exception
          self._exception = exception
          self._state = self.FINISHED
docs: Sets the result of the future as being the given exception.
  
          Should only be used by Task and unit tests.