<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):
 """Set the result of the future to the given exception. Args: exception (:exc:`Exception`):
 The exception raised. """

        # Sanity check: A future can only complete once.
        if self.done():
            raise RuntimeError("set_exception can only be called once.")

        # Set the exception and trigger the future.
        self._exception = exception
        self._trigger()