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

def check_pid ( pid ) : try : os . kill ( pid , 0 ) except OSError : return False else : return True
check if a process is running with the given pid .