<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_exception(self, exception):
 """Sets the result of the future as being the given exception. Should only be used by Task and unit tests. """

        assert isinstance(exception, Exception), \
            "%r should be an Exception" % exception
        self._exception = exception
        self._state = self.FINISHED