Create dict copy with removed items.

    Recursively remove items where fn(value) is True.

    Returns:
        dict: New dict with matching items removed.
420620
def deep_del(data, fn):
    
    result = {}

    for k, v in data.iteritems():
        if not fn(v):
            if isinstance(v, dict):
                result[k] = deep_del(v, fn)
            else:
                result[k] = v

    return result
1115010
def deep_copy(numpy_dict):
  
  out = {}
  for key in numpy_dict:
    out[key] = numpy_dict[key].copy()
  return out
345790
def _recursive_cleanup(foo):
    
    if isinstance(foo, dict):
        for (key, val) in list(foo.items()):
            if isinstance(val, dict):
                _recursive_cleanup(val)
            if val == "" or val == [] or val == {}:
                del foo[key]
1117726
def clear(self, exclude=None):
        
        if exclude is None:
            self.cache = {}
        else:
            self.cache = {k: v for k, v in self.cache.items()
                          if k in exclude}
304653
def without(self, *keys):
        
        items = copy(self.items)

        keys = reversed(sorted(keys))

        for key in keys:
            del items[key]

        return self.__class__(items)
1366225
def compare_dicts(old=None, new=None):
    '''
    
    '''
    ret = {}
    for key in set((new or {})).union((old or {})):
        if key not in old:
            # New key
            ret[key] = {'old': '',
                        'new': new[key]}
        elif key not in new:
            # Key removed
            ret[key] = {'new': '',
                        'old': old[key]}
        elif new[key] != old[key]:
            # Key modified
            ret[key] = {'old': old[key],
                        'new': new[key]}
    return ret
228306
def clean(source):
    

    if isinstance(source, dict):
        for key, value in source.items():
            if key == "Fn::Join":
                return convert_join(value)
            else:
                source[key] = clean(value)

    elif isinstance(source, list):
        return [clean(item) for item in source]

    return source
1161530
def clean_list(l0, clean_item_fn=None):
    
    clean_item_fn = clean_item_fn if clean_item_fn else clean_item
    l = list()
    for index, item in enumerate(l0):
        cleaned_item = clean_item_fn(item)
        l.append(cleaned_item)
    return l
1329667
def clean_dict(d, test=lambda v: v):
    
    return {k: v for k, v in d.items() if test(v)}
1155632
def _remove_none_values(dictionary):
    
    return list(map(dictionary.pop,
                    [i for i in dictionary if dictionary[i] is None]))
865147
def removeduplicates(self, entries = None):
        '''
        
        '''
        removed = []
        if entries == None:
            entries = {}
        new_children = []
        for c in self.children:
            cs = str(c)
            cp = entries.get(cs,None)
            if cp:
                new_children.append(cp)
                removed.append(c)
            else:
                dups = c.removeduplicates(entries)
                if dups:
                    removed.extend(dups)
                entries[cs] = c
                new_children.append(c)
        self.children = new_children
        return removed
937448
def GroupBy(self: dict, f=None):
    
    if f and is_to_destruct(f):
        f = destruct_func(f)
    return _group_by(self.items(), f)
397425
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
546912
def popdict(src, keys):
    
    new = {}
    for key in keys:
        if key in src:
            new[key] = src.pop(key)
    return new
1134570
def de_duplicate(items):
    
    result = []
    for item in items:
        if item not in result:
            result.append(item)
    return result
424485
def delete_list_items(list_, item_list, copy=False):
    
    """
    if copy:
        list_ = list_[:]
    for item in item_list:
        list_.remove(item)
    return list_
217064
def _drop_none_values(dictionary: Dict) -> Dict:
    
    return {key: value for key, value in dictionary.items() if value is not None}