def union(self, E):
        """
        Return the union of the sets of self with the sets of E.
        
        (i.e. all elements that are in either sets of the DictSets.)

        DS|E  <==> DS.union(E)
        """        
        if not isinstance(E, DictSet):
            E = DictSet(copy(E))
            
        foo = deepcopy(self)
        for k in set(foo.keys()) | set(E.keys()):
            foo.setdefault(k, [])
            foo[k].update(E.get(k, []))
            if not foo[k]:
                del foo[k] # delete if empty set

        return foo

        Return the union of the sets of self with the sets of E.
        
        (i.e. all elements that are in either sets of the DictSets.)

        DS|E  <==> DS.union(E)
        
recipes/Python/577702_DictSet__specialized_Pythcontainer_datatype/recipe-577702.py