code: def dictapply(d, fn):
      
      for k, v in d.items():
          if isinstance(v, dict):
              v = dictapply(v, fn)
          else:
              d[k] = fn(v)
      return d
docs: apply a function to all non-dict values in a dictionary