<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):
 """Complete all tasks. """

        for future in self.traverse():
            # All cancelled futures should have callbacks to removed itself
            # from this linked list. However, these callbacks are scheduled in
            # an event loop, so we could still find them in our list.
            future.set_result(result)
        if not self.done():
            super().set_result(result)