code: def get_exitcode_stdout_stderr(cmd):
      
      from subprocess import Popen, PIPE
      import shlex
      args = shlex.split(cmd)
  
      proc = Popen(args, stdout=PIPE, stderr=PIPE)
      out, err = proc.communicate()
      exitcode = proc.returncode
  
      return exitcode, out, err
docs: Execute the external command and get its exitcode, stdout and stderr.