def _lookup(value2num, value):
    """Value lookup function with propagation through `id` values.
    """
    if value.op == 'id':
        return value.args[0]  # Use the underlying value number.
    else:
        return value2num.get(value)