def haproxy_pid():
 try:
  pid = subprocess.check_output(['pidof', 'haproxy'])
 except subprocess.CalledProcessError:
  return None
 return pid.rstrip()

def haproxy_pid ( ) : try : pid = subprocess . check_output ( [ 'pidof' , 'haproxy' ] ) except subprocess . CalledProcessError : return None return pid . rstrip ( )
finds out the pid of haproxy process .