<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def walk_json(d, func):
 """ Walk over a parsed JSON nested structure `d`, apply `func` to each leaf element and replace it with result """

    if isinstance(d, Mapping):
        return OrderedDict((k, walk_json(v, func)) for k, v in d.items())
    elif isinstance(d, list):
        return [walk_json(v, func) for v in d]
    else:
        return func(d)