def output_value(output, fail_on_err=False):
    """Returns the value of the command output"""
    stdout, stderr = output.communicate()
    if output.returncode == 0:
        return stdout
    elif fail_on_err:
        raise ValueError(stderr)
    else:
        return stderr
