def _process_exists(pid):
 try:
  os.kill(pid, 0)
 except OSError:
  return False
 return True

def _process_exists ( pid ) : try : os . kill ( pid , 0 ) except OSError : return False return True
check if a process with pid pid exists .