<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_result(self, result):
 """ Allows you to set the result of the future without requiring the future to actually be executed. This can be used if the result is available before the future is run, allowing you to keep the future as the interface for retrieving the result data. :param result: The result of the future. :raise RuntimeError: If the future is already enqueued. """


    with self._lock:
      if self._enqueued:
        raise RuntimeError('can not set result of enqueued Future')
      self._result = result
      self._completed = True
      callbacks = self._prepare_done_callbacks()
    callbacks()