human
Here's a good function header given the following:
I wrote the below code

    def check_timeout(delay):
        if (timeout is not None):
            if (timer() >= stop_at):
                raise TimeoutExpired()
        time.sleep(delay)
        return min((delay * 2), 0.04)
    timer = getattr(time, 'monotonic', time.time)
    if (timeout is not None):
        def waitcall():
            return os.waitpid(pid, os.WNOHANG)
        stop_at = (timer() + timeout)
    else:
        def waitcall():
            return os.waitpid(pid, 0)
    delay = 0.0001
    while True:
        try:
            (retpid, status) = waitcall()
        except OSError as err:
            if (err.errno == errno.EINTR):
                delay = check_timeout(delay)
                continue
            elif (err.errno == errno.ECHILD):
                while True:
                    if pid_exists(pid):
                        delay = check_timeout(delay)
                    else:
                        return
            else:
                raise
        else:
            if (retpid == 0):
                delay = check_timeout(delay)
                continue
            if os.WIFSIGNALED(status):
                return (- os.WTERMSIG(status))
            elif os.WIFEXITED(status):
                return os.WEXITSTATUS(status)
            else:
                raise ValueError(('unknown    process    exit    status    %r' % status))

What's a good function header?
assistant
#Here's a good function header.

def wait_pid(pid, timeout=None):