code: async def cancellable_wait(self, *awaitables: Awaitable[_R], timeout: float = None) -> _R:
          futures = [asyncio.ensure_future(a, loop=self.loop) for a in awaitables + (self.wait(),)]
          try:
              done, pending = await asyncio.wait(
                  futures,
                  timeout=timeout,
                  return_when=asyncio.FIRST_COMPLETED,
                  loop=self.loop,
              )
          except asyncio.futures.CancelledError:
              for future in futures:
                  future.cancel()
              raise
          for task in pending:
              task.cancel()
          if not done:
              raise TimeoutError()
          if self.triggered_token is not None:
              for task in done:
                  task.exception()
              raise OperationCancelled(
                  "Cancellation requested by {} token".format(self.triggered_token)
              )
          return done.pop().result()