code: def capture_command(args, shell=False, cwd=None, env=None, stdin=None, cmd_encoding='utf-8'):
      
      p = subprocess.Popen(
          __convert_args(args, shell, cmd_encoding), shell=shell, cwd=cwd, env=__convert_env(env, cmd_encoding),
          stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      stdout_data, stderr_data = p.communicate()
      return p.returncode, stdout_data, stderr_data
docs: Execute external command and capture output
      :param args: command line arguments : [string]
      :param shell: True when using shell : boolean
      :param cwd: working directory : string
      :param env: environment variables : dict
      :param stdin: standard input
      :param cmd_encoding: command line encoding: string
      :return: tuple of return code, stdout data and stderr data