code: def remove_paths(d, keys, list_of_dicts=False, deepcopy=True):
      
      keys = [(key,) if not isinstance(key, tuple) else key for key in keys]
      list_of_dicts = '__list__' if list_of_dicts else None
  
      def contains(path):
          for k in keys:
              if set(k).issubset(path):
                  return True
          return False
  
      flatd = flatten(d, list_of_dicts=list_of_dicts)
  
      flatd = {path: v for path, v in flatd.items() if not contains(path)}
  
      return unflatten(flatd, list_of_dicts=list_of_dicts, deepcopy=deepcopy)
docs: remove paths containing certain keys from dict
  
      Parameters
      ----------
      d: dict
      keys : list
          list of keys to find and remove path
      list_of_dicts: bool
          treat list of dicts as additional branches
      deepcopy: bool
          deepcopy values
  
      Examples
      --------
  
      >>> from pprint import pprint
      >>> d = {1:{"a":"A"},2:{"b":"B"},4:{5:{6:'a',7:'b'}}}
      >>> pprint(remove_paths(d,[6,'a']))
      {2: {'b': 'B'}, 4: {5: {7: 'b'}}}
  
      >>> d = {1:{2: 3}, 1:{4: 5}}
      >>> pprint(remove_paths(d,[(1, 2)]))
      {1: {4: 5}}
  
  
      >>> d2 = {'a':[{'b':1,'c':{'b':3}},{'b':1,'c':2}]}
      >>> pprint(remove_paths(d2,["b"],list_of_dicts=False))
      {'a': [{'b': 1, 'c': {'b': 3}}, {'b': 1, 'c': 2}]}
  
      >>> pprint(remove_paths(d2,["b"],list_of_dicts=True))
      {'a': [{'c': 2}]}