code: def nested_map(x, f):
    
    if isinstance(x, list):
      return [nested_map(y, f) for y in x]
    if isinstance(x, tuple):
      return tuple([nested_map(y, f) for y in x])
    if isinstance(x, dict):
      return {k: nested_map(x[k], f) for k in x}
    return f(x)
docs: Map the function f to the nested structure x (dicts, tuples, lists).