def proc_exists(pid):
 if (not os.path.exists(('/proc/%s' % pid))):
  raise NoSuchProcess()

def proc_exists ( pid ) : if ( not os . path . exists ( ( '/proc/%s' % pid ) ) ) : raise NoSuchProcess ( )
check the a pid is registered in /proc raise nosuchprocess exception if not .