code: def dict_filter(d, exclude=[]):
      
  
      if isinstance(d, list):
          ret = []
          for e in d:
              ret.append(dict_filter(e, exclude))
          return ret
      elif isinstance(d, dict):
          ret = {}
          for k, v in d.items():
              if isinstance(k, builtin_str):
                  k = str(k)
  
              assert isinstance(k, str)
              if k in exclude:
                  continue
              ret[k] = dict_filter(v, exclude)
          return ret
  
      return d
docs: Exclude specified keys from a nested dict