def find_fork_top_parent(pid):
 while True:
  ppid = find_parent_pid(pid)
  if (ppid and (ppid != pid) and pid_invoked_with_cmdline(ppid, get_cmdline_from_pid(pid))):
   pid = ppid
  else:
   return pid

def find_fork_top_parent ( pid ) : while True : ppid = find_parent_pid ( pid ) if ( ppid and ( ppid != pid ) and pid_invoked_with_cmdline ( ppid , get_cmdline_from_pid ( pid ) ) ) : pid = ppid else : return pid
retrieve the pid of the top parent of the given pid through a fork .