def pipe_shell_cmds(shell_CMDs):
len = shell_CMDs.__len__()<EOL>p = {}<EOL>p[<NUM_LIT:1>] = subprocess.Popen(shlex.split(shell_CMDs[<NUM_LIT:1>]), stdout=subprocess.PIPE,stderr=subprocess.PIPE)<EOL>for i in range(<NUM_LIT:2>,len):<EOL><INDENT>p[i] = subprocess.Popen(shlex.split(shell_CMDs[i]), stdin=p[i-<NUM_LIT:1>].stdout, stdout=subprocess.PIPE,stderr=subprocess.PIPE)<EOL><DEDENT>if(len > <NUM_LIT:1>):<EOL><INDENT>p[len] = subprocess.Popen(shlex.split(shell_CMDs[len]), stdin=p[len-<NUM_LIT:1>].stdout, stdout=subprocess.PIPE,stderr=subprocess.PIPE)<EOL><DEDENT>result = p[len].communicate()<EOL>if(len > <NUM_LIT:1>):<EOL><INDENT>for i in range(<NUM_LIT:2>,len+<NUM_LIT:1>):<EOL><INDENT>returncode = p[i].wait()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>returncode = p[len].wait()<EOL><DEDENT>return(result)<EOL>
shell_CMDs = {}
shell_CMDs[1] = 'netstat -n'
shell_CMDs[2] = "awk {'print $6'}"