def run_cmd(cmd):
process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE,<EOL>stderr=subprocess.PIPE)<EOL>(stdout, stderr) = process.communicate()<EOL>return stdout, stderr, process.wait()<EOL>
Run a command and return a tuple with (stdout, stderr, exit_code)