def kill_processes(pids):
    while pids:
        pid = pids.pop()
        if is_process_alive(pid):
            try:
                logging.info("Sending SIGKILL to PID: %d" % pid)
                os.kill(pid, 9)
            except __HOLE__, e:
                if e.errno == errno.ESRCH:
                    # process is dead already, no need to do anything
                    pass
                else:
                    raise
            else:
                # We'll check if the process is dead in a later iteration
                pids.insert(0, pid)
dataset/ETHPy150Open YelpArchive/pushmanager/pushmanager/core/pid.py/kill_processes