cmd = 'ssh -f -N -p ' + str(serverport) + ' -l ' + serveruser + ' -L ' + str(
    tunnelport) + ':' + nodehost + ':' + str(nodeport) + ' ' + serverhost
args = shlex.split(cmd)
tun = subprocess.Popen(args)
stat = tun.poll()
SSH to machine through a middle host