'return False if the timeout occured'

def wait(self, timeout=None):

    if (self.hProcess is None):
        return True
    starttime = time.time()
    while True:
        try:
            res = ctypes.windll.kernel32.WaitForSingleObject(self.hProcess, DWORD(1))
            if (res != WAIT_TIMEOUT):
                break
            if ((timeout is not None) and ((time.time() - starttime) > timeout)):
                return False
        except KeyboardInterrupt:
            break
    return True
