def system_call(cmd, **kwargs):
    """Call cmd and return (stdout, stderr, return_value).

    Parameters
    ----------
    cmd: str
        Can be either a string containing the command to be run, or a sequence
        of strings that are the tokens of the command.
    kwargs : dict, optional
        Ignored. Available so that this function is compatible with
        _redis_wrap.

    Notes
    -----
    This function is ported from QIIME (http://www.qiime.org), previously
    named qiime_system_call. QIIME is a GPL project, but we obtained permission
    from the authors of this function to port it to pyqi (and keep it under
    pyqi's BSD license).
    """
    proc = Popen(cmd,
                 universal_newlines=True,
                 shell=True,
                 stdout=PIPE,
                 stderr=PIPE)
    # communicate pulls all stdout/stderr from the PIPEs to
    # avoid blocking -- don't remove this line!
    stdout, stderr = proc.communicate()
    return_value = proc.returncode

    if return_value != 0:
        raise ValueError("Failed to execute: %s\nstdout: %s\nstderr: %s" %
                         (cmd, stdout, stderr))

    return stdout, stderr, return_value
Call cmd and return (stdout, stderr, return_value).

    Parameters
    ----------
    cmd: str
        Can be either a string containing the command to be run, or a sequence
        of strings that are the tokens of the command.
    kwargs : dict, optional
        Ignored. Available so that this function is compatible with
        _redis_wrap.

    Notes
    -----
    This function is ported from QIIME (http://www.qiime.org), previously
    named qiime_system_call. QIIME is a GPL project, but we obtained permission
    from the authors of this function to port it to pyqi (and keep it under
    pyqi's BSD license).