<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rpm_eval(macro):
 """Get value of given macro using rpm tool"""

    try:
        value = subprocess.Popen(
            ['rpm', '--eval', macro],
            stdout=subprocess.PIPE).communicate()[0].strip()
    except OSError:
        logger.error('Failed to get value of {0} rpm macro'.format(
            macro), exc_info=True)
        value = b''
    return console_to_str(value)