<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def valuemap(f):
 """ Decorator to help PEG functions handle value conversions. """

    @wraps(f)
    def wrapper(*args, **kwargs):
        if 'value' in kwargs:
            val = kwargs['value']
            del kwargs['value']
            _f = f(*args, **kwargs)
            def valued_f(*args, **kwargs):
                result = _f(*args, **kwargs)
                s, obj, span = result
                if callable(val):
                    return PegreResult(s, val(obj), span)
                else:
                    return PegreResult(s, val, span)
            return valued_f
        else:
            return f(*args, **kwargs)
    return wrapper