<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_subprocess_output(command, log, raise_on_empty_output=True, log_debug=True):
 """ Run the given subprocess command and return its output. Raise an Exception if an error occurs. :param command: The command to run. Using a list of strings is recommended. The command will be run in a subprocess without using a shell, as such shell features like shell pipes, wildcard expansion, environment variable expansion, etc., are not supported. :type command: list(str) or str :param logging.Logger log: The log object to use :param bool raise_on_empty_output: Whether to raise a SubprocessOutputEmptyError exception when the subprocess doesn't output anything to its stdout. :param bool log_debug: Whether to enable debug logging of full command. :returns: The stdout contents, stderr contents and status code of the command :rtype: tuple(str, str, int) """


    cmd_args = []
    if isinstance(command, string_types):
        for arg in command.split():
            cmd_args.append(arg)
    elif hasattr(type(command), '__iter__'):
        for arg in command:
            cmd_args.append(arg)
    else:
        raise TypeError('command must be a sequence or string')

    if log_debug:
        log.debug('Running get_subprocess_output with cmd: {}'.format(cmd_args))

    out, err, returncode = subprocess_output(cmd_args, raise_on_empty_output)

    log.debug(
        'get_subprocess_output returned '
        '(len(out): {} ; len(err): {} ; returncode: {})'.format(len(out), len(err), returncode)
    )

    out = ensure_unicode(out) if out is not None else None
    err = ensure_unicode(err) if err is not None else None

    return out, err, returncode