def kill_child_processes(parent_pid, sig=signal.SIGTERM):
    ps_command = subprocess.Popen('ps -o pid --ppid %d --noheaders' %
        parent_pid, shell=True, stdout=subprocess.PIPE)
obtaining pid of child process