Example:
        >>> # DISABLE_DOCTEST
        >>> dict1 = {1:1, 2:2, 3:3}
        >>> dict2 = {2:3, 3:3}
        >>> assert_keys_are_subset(dict1, dict2)
        >>> #dict2 = {4:3, 3:3}
976287
def assert_keys_are_subset(dict1, dict2):
    
    keys1 = set(dict1.keys())
    keys2 = set(dict2.keys())
    unknown_keys = keys2.difference(keys1)
    assert len(unknown_keys) == 0, 'unknown_keys=%r' % (unknown_keys,)
1022230
def _eq_dicts(d1, d2):
        """"""
        if not d1.keys() == d2.keys():
            return False

        for k, v1 in d1.items():
            v2 = d2[k]
            if not type(v1) == type(v2):
                return False
            if isinstance(v1, np.ndarray):
                if not np.array_equal(v1, v2):
                    return False
            else:
                if not v1 == v2:
                    return False
        return True
187369
def _get_diffs(cls, dict1, dict2, ignore_missing_keys):
        '''
        
        '''
        ret_dict = {}
        for p in dict1.keys():
            if p not in dict2:
                ret_dict.update({p: {'new': dict1[p], 'old': cls.NONE_VALUE}})
            elif dict1[p] != dict2[p]:
                if isinstance(dict1[p], dict) and isinstance(dict2[p], dict):
                    sub_diff_dict = cls._get_diffs(dict1[p], dict2[p],
                                                   ignore_missing_keys)
                    if sub_diff_dict:
                        ret_dict.update({p: sub_diff_dict})
                else:
                    ret_dict.update({p: {'new': dict1[p], 'old': dict2[p]}})
        if not ignore_missing_keys:
            for p in dict2.keys():
                if p not in dict1.keys():
                    ret_dict.update({p: {'new': cls.NONE_VALUE,
                                         'old': dict2[p]}})
        return ret_dict
464704
def dict_setdiff(dict_, negative_keys):
    
    """
    keys = [key for key in six.iterkeys(dict_)
            if key not in set(negative_keys)]
    subdict_ = dict_subset(dict_, keys)
    return subdict_
1248045
def check_structure(self, keys):
        
        """
        return set(keys) <= set([self.__options['attrkey'], self.__options['valuekey']])
546912
def popdict(src, keys):
    
    new = {}
    for key in keys:
        if key in src:
            new[key] = src.pop(key)
    return new
93336
def key_assoc_val(d, func, exclude=None):
    
    vs = list(d.values())
    ks = list(d.keys())
    key = ks[vs.index(func(vs))]
    return key
874867
def diff_dict(dict1, dict2, ignore_missing=False):
    """"""
    unidict1 = dict_unicodeize(dict1)
    unidict2 = dict_unicodeize(dict2)
    if ((not ignore_missing) and (len(unidict1) != len(unidict2))) or \
       (ignore_missing and (len(unidict1) >= len(unidict2))):
        return True

    for comp_k, comp_v in iteritems(unidict1):
        if comp_k not in unidict2:
            return True
        else:
            if comp_v != unidict2[comp_k]:
                return True

    return False
1086585
function(a, b, aParent, bParent, prop, compares, options){
		var subsetCompare = function(a, b, aParent, bParent, prop){
			var compare = compares[prop] === undefined ? compares['*'] : compares[prop];

			if (! loop(a, b, aParent, bParent, prop, compare, options ) ) {
				var subsetCheck;
				if( !(prop in aParent)) {
					subsetCheck = "subsetB";
				}
				if( !(prop in bParent) ) {
					subsetCheck = "subsetA";
				}
				if(subsetCheck) {
					if( !options.subset ) {
						options.subset = subsetCheck;
					}
					return options.subset === subsetCheck ? undefined: false;
				}

				return false;
			}
		};

		var aType = typeof a;
		if(aType === 'object' || aType === 'function') {
			return h.eachInUnique(a, subsetCompare, b, subsetCompare, true);
		}
	}
436520
def validate_list_of_identical_dicts(self, list_of_dicts):
        """"""
        hashes = []
        for _dict in list_of_dicts:
            hashes.append(hash(frozenset(_dict.items())))

        self.log.debug('Hashes: {}'.format(hashes))
        if len(set(hashes)) == 1:
            self.log.debug('Dicts within list are identical')
        else:
            return 'Dicts within list are not identical'

        return None
792509
def merge_dicts(dict_a, dict_b):
    
    def _merge_dicts_(a, b):
        for key in set(a.keys()).union(b.keys()):
            if key in a and key in b:
                if isinstance(a[key], dict) and isinstance(b[key], dict):
                    yield (key, dict(_merge_dicts_(a[key], b[key])))
                elif b[key] is not None:
                    yield (key, b[key])
                else:
                    yield (key, a[key])
            elif key in a:
                yield (key, a[key])
            elif b[key] is not None:
                yield (key, b[key])
    return dict(_merge_dicts_(dict_a, dict_b))
91624
def dict_minus(d, *keys):
    """"""
    # make shallow copy
    d = dict(d)
    for key in keys:
        try:
            del d[key]
        except:
            pass
    return d
195647
def _ordered_keys(dict_):
        
        return isinstance(dict_, OrderedDict) and dict_.keys() or \
               dict_ and sorted(dict_.keys()) or []
1077617
def _merge_dicts(self, dict1, dict2, path=[]):
        ""
        for key in dict2:
            if key in dict1:
                if isinstance(dict1[key], dict) and isinstance(dict2[key], dict):
                    self._merge_dicts(dict1[key], dict2[key], path + [str(key)])
                elif dict1[key] != dict2[key]:
                    if self._options.get('allowmultioptions', True):
                        if not isinstance(dict1[key], list):
                            dict1[key] = [dict1[key]]
                        if not isinstance(dict2[key], list):
                            dict2[key] = [dict2[key]]
                        dict1[key] = self._merge_lists(dict1[key], dict2[key])
                    else:
                        if self._options.get('mergeduplicateoptions', False):
                            dict1[key] = dict2[key]
                        else:
                            raise error.ApacheConfigError('Duplicate option "%s" prohibited' % '.'.join(path + [str(key)]))
            else:
                dict1[key] = dict2[key]
        return dict1
626235
def dict_of_sets_add(dictionary, key, value):
    # type: (DictUpperBound, Any, Any) -> None
    
    set_objs = dictionary.get(key, set())
    set_objs.add(value)
    dictionary[key] = set_objs
184955
def exclude(source, keys, *, transform=None):
  
  check = keys if callable(keys) else lambda key: key in keys
  return {key: transform(source[key]) if transform else source[key]
          for key in source if not check(key)}
1131278
def compare_3PC_keys(key1, key2) -> int:
    
    if key1[0] == key2[0]:
        return key2[1] - key1[1]
    else:
        return key2[0] - key1[0]