def wait_for_window(self, wname, timeout=0, interval=0.005):
    if timeout < 0:
      raise ValueError("'timeout' must be a positive number")

    start_time = time.time()

    while True:
      for window in self._enumerate_windows()[1]:
        if wname.lower() in window.lower():
          #If the window exists return window hwnd
          return self.get_window_hwnd(window)

      if time.time() - start_time > timeout:
        #If we passed the timeout, return False
        #Not sure if it's best to raise None or an Exception though
        return False

      time.sleep(interval)
dataset/ETHPy150Open chriskiehl/pyrobot/pyrobot.py/Robot.wait_for_window/original