def run_cmd(cmd, stderr_levels=('warn', 'error'), **kwargs):

    log.debug(cmd if isinstance(cmd, basestring) else ' '.join(cmd))
    proc = subprocess.Popen(cmd,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            **kwargs)
    stdout, stderr = proc.communicate()
    if stdout: log.debug("stdout: " + stdout)
    if stderr:
        stderr_level = stderr_levels[int(proc.returncode>0)]
        if stderr_level:
            getattr(log, stderr_level)("stderr: " + stderr)
    return proc

# TODO: join two together
The domain-search option specifies a 'search list' of Domain Names to
dataset/ETHPy150Open pydata/vbench/vbench/utils.py/run_cmd--crossover with--dataset/ETHPy150Open rtucker-mozilla/mozilla_inventory/core/keyvalue/base_option.py/CommonOption._aa_search_domain