code: def _wait_response(self, ready, timeout_sec):
          
          # Wait for the measurement to be ready (or a timeout elapses).
          start = time.time()
          while True:
              # Check if the timeout has elapsed.
              if (time.time() - start) >= timeout_sec:
                  raise RuntimeError('Exceeded timeout waiting for VCNL40xx response, check your wiring.')
              # Check if result is ready and return it.
              result = self._device.readU8(VCNL40xx_COMMAND)
              if (result & ready) > 0:
                  return
              # Otherwise delay for a bit and try reading again.
              time.sleep(0.001)
docs: Wait for a response to be ready (the provided ready bits are set).
          If the specified timeout (in seconds) is exceeded and error will be
          thrown.