code: def await_paused(self, timeout=None):
      
      deadline = time.time() + timeout if timeout else None
      with self._lock:
        # Wait until the service transitions out of Pausing.
        while self._state != self._PAUSED:
          if self._state != self._PAUSING:
            raise AssertionError('Cannot wait for {} to reach `{}` while it is in `{}`.'.format(self, self._PAUSED, self._state))
          timeout = deadline - time.time() if deadline else None
          if timeout and timeout <= 0:
            return False
          self._condition.wait(timeout=timeout)
        return True
docs: Blocks until the service is in the Paused state, then returns True.
  
      If a timeout is specified, the method may return False to indicate a timeout: with no timeout
      it will always (eventually) return True.
  
      Raises if the service is not currently in the Pausing state.