def sp_check_output(*popenargs, **kwargs):

    if is_py26():
        # NOTE(andreykurilin): as I said before, support python 26 env is hard
        # task. Subprocess supports check_output function from Python 2.7, so
        # let's copy-paste code of this function from it.
        if "stdout" in kwargs:
            raise ValueError("stdout argument not allowed, "
                             "it will be overridden.")
        process = subprocess.Popen(stdout=subprocess.PIPE,
                                   *popenargs, **kwargs)
        output, unused_err = process.communicate()
        retcode = process.poll()
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
            raise subprocess.CalledProcessError(retcode, cmd, output=output)
        return output
    return subprocess.check_output(*popenargs, **kwargs)
Run command with arguments and return its output as a byte string.
dataset/ETHPy150Open openstack/rally/rally/common/costilius.py/sp_check_output