def diff(self, other):
        assert(self.__class__ == other.__class__)
        if self._data is not None and self._data == other._data:
            return None

        us = set(self.iterAll())
        them = set(other.iterAll())
        added = us - them
        removed = them - us

        if not added and not removed:
            return None

        l = []
        if len(removed) >= (1 << 16):
            raise OverflowError
        if len(added) >= (1 << 16):
            raise OverflowError
        l.append(struct.pack("!HH", len(removed), len(added)))

        for typeId, item in itertools.chain(removed, added):
            s = item.freeze()
            if len(s) >= (1 << 16):
                raise OverflowError
            l.append(struct.pack("!BH", typeId, len(s)))
            l.append(s)

        return "".join(l)
dataset/ETHPy150Open sassoftware/conary/conary/streams.py/StreamCollection.diff/original