nest_map을 만드세유
def nested_map(struct, map_fn):
if isinstance(struct, tuple):
return tuple(nested_map(x, map_fn) for x in struct)
if isinstance(struct, list):
return [nested_map(x, map_fn) for x in struct]
if isinstance(struct, dict):
return {k: nested_map(v, map_fn) for k, v in struct.items()}
return map_fn(struct)