def wait(self, timeout=None, check_interval=0.01):
        # Instead of a blocking OS call, this version of wait() uses logic
        # borrowed from the guv 0.2 processes.Process.wait() method.
        if timeout is not None:
            endtime = time.time() + timeout
        try:
            while True:
                status = self.poll()
                if status is not None:
                    return status
                if timeout is not None and time.time() > endtime:
                    raise TimeoutExpired(self.args, timeout)
                sleep(check_interval)
        except OSError as e:
            if e.errno == errno.ECHILD:
                # no child process, this happens if the child process
                # already died and has been cleaned up
                return -1
            else:
                raise

        # don't want to rewrite the original _communicate() method, we
        # just want a version that uses guv.green.select.select()
        # instead of select.select().
        _communicate = FunctionType(subprocess_orig.Popen._communicate.__code__, globals())
        try:
            _communicate_with_select = FunctionType(
                subprocess_orig.Popen._communicate_with_select.__code__, globals())
            _communicate_with_poll = FunctionType(
                subprocess_orig.Popen._communicate_with_poll.__code__, globals())
        except __HOLE__:
            pass
dataset/ETHPy150Open veegee/guv/guv/green/subprocess.py/Popen.wait