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:
              # Since we use return_when=asyncio.FIRST_COMPLETED above, we can be sure none of our
              # futures will be done here, so we don't need to check if any is done before cancelling.
              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:
              # We've been asked to cancel so we don't care about our future, but we must
              # consume its exception or else asyncio will emit warnings.
              for task in done:
                  task.exception()
              raise OperationCancelled(
                  "Cancellation requested by {} token".format(self.triggered_token)
              )
          return done.pop().result()
docs: Wait for the first awaitable to complete, unless we timeout or the
          token is triggered.
  
          Returns the result of the first awaitable to complete.
  
          Raises TimeoutError if we timeout or
          `~cancel_token.exceptions.OperationCancelled` if the cancel token is
          triggered.
  
          All pending futures are cancelled before returning.