def execute(cls, cmd, stdin_payload=None, **kwargs):
    """Execute a command via subprocess.Popen and returns the stdio.

    :param string|list cmd: A list or string representing the command to run.
    :param string stdin_payload: A string representing the stdin payload, if any, to send.
    :param **kwargs: Additional kwargs to pass through to subprocess.Popen.
    :return: A tuple of strings representing (stdout, stderr), pre-decoded for utf-8.
    :raises: `Executor.ExecutableNotFound` when the executable requested to run does not exist.
             `Executor.NonZeroExit` when the execution fails with a non-zero exit code.
    """
    process = cls.open_process(cmd=cmd,
                               stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               **kwargs)
    stdout_raw, stderr_raw = process.communicate(input=stdin_payload)
    # N.B. In cases where `stdout` or `stderr` is passed as parameters, these can be None.
    stdout = stdout_raw.decode('utf-8') if stdout_raw is not None else stdout_raw
    stderr = stderr_raw.decode('utf-8') if stderr_raw is not None else stderr_raw

    if process.returncode != 0:
      raise cls.NonZeroExit(cmd, process.returncode, stdout, stderr)

    return stdout, stderr
Execute a command via subprocess.Popen and returns the stdio.

    :param string|list cmd: A list or string representing the command to run.
    :param string stdin_payload: A string representing the stdin payload, if any, to send.
    :param **kwargs: Additional kwargs to pass through to subprocess.Popen.
    :return: A tuple of strings representing (stdout, stderr), pre-decoded for utf-8.
    :raises: `Executor.ExecutableNotFound` when the executable requested to run does not exist.
             `Executor.NonZeroExit` when the execution fails with a non-zero exit code.