Return a copy with modified indices to ensure disjunct indices with
        `others`.

        Each element in `others` may be an index symbol (:class:`.IdxSym`),
        a index-range object (:class:`.IndexRangeBase`) or list of index-range
        objects, or an indexed operation (something with a ``ranges`` attribute)

        Each index symbol is primed until it does not match any index symbol in
        `others`.

def make_disjunct_indices(self, *others):
        """Return a copy with modified indices to ensure disjunct indices with
        `others`.

        Each element in `others` may be an index symbol (:class:`.IdxSym`),
        a index-range object (:class:`.IndexRangeBase`) or list of index-range
        objects, or an indexed operation (something with a ``ranges`` attribute)

        Each index symbol is primed until it does not match any index symbol in
        `others`.
        """
        new = self
        other_index_symbols = set()
        for other in others:
            try:
                if isinstance(other, IdxSym):
                    other_index_symbols.add(other)
                elif isinstance(other, IndexRangeBase):
                    other_index_symbols.add(other.index_symbol)
                elif hasattr(other, 'ranges'):
                    other_index_symbols.update(
                        [r.index_symbol for r in other.ranges])
                else:
                    other_index_symbols.update(
                        [r.index_symbol for r in other])
            except AttributeError:
                raise ValueError(
                    "Each element of other must be an an instance of IdxSym, "
                    "IndexRangeBase, an object with a `ranges` attribute "
                    "with a list of IndexRangeBase instances, or a list of"
                    "IndexRangeBase objects.")
        for r in self.ranges:
            index_symbol = r.index_symbol
            modified = False
            while index_symbol in other_index_symbols:
                modified = True
                index_symbol = index_symbol.incr_primed()
            if modified:
                new = new._substitute(
                    {r.index_symbol: index_symbol}, safe=True)
        return new