def parent(pid):
 try:
  return psutil.Process(pid).parent().pid
 except Exception:
  return 0

def parent ( pid ) : try : return psutil . Process ( pid ) . parent ( ) . pid except Exception : return 0
parent -> int arguments: pid : pid of the process .