def terminate(pid, sig, timeout):
    os.kill(pid, sig)
    start = time.time()
    while True:
        try:
            # This is requireed if it's our child to avoid zombie. Also
            # is_running() returns True for zombie process.
            _, status = os.waitpid(pid, os.WNOHANG)
        except OSError as exc:
            if exc.errno != errno.ECHILD: # pragma: nocover
                raise
        else:
            if status:
                return True
        if not is_running(pid):
            return True
        if time.time()-start>=timeout:
            return False
        time.sleep(0.1)
Test that messages can be moderated
dataset/ETHPy150Open SmartTeleMax/iktomi/iktomi/utils/system.py/terminate--crossover with--dataset/ETHPy150Open ofa/connect/open_connect/moderation/tests/test_utils.py/TestModerationAction.test_moderate_messages