def difference(self, other, sort=None):
self._validate_sort_keyword(sort)<EOL>self._assert_can_do_setop(other)<EOL>other, result_names = self._convert_can_do_setop(other)<EOL>if len(other) == <NUM_LIT:0>:<EOL><INDENT>return self<EOL><DEDENT>if self.equals(other):<EOL><INDENT>return MultiIndex(levels=self.levels,<EOL>codes=[[]] * self.nlevels,<EOL>names=result_names, verify_integrity=False)<EOL><DEDENT>this = self._get_unique_index()<EOL>indexer = this.get_indexer(other)<EOL>indexer = indexer.take((indexer != -<NUM_LIT:1>).nonzero()[<NUM_LIT:0>])<EOL>label_diff = np.setdiff1d(np.arange(this.size), indexer,<EOL>assume_unique=True)<EOL>difference = this.values.take(label_diff)<EOL>if sort is None:<EOL><INDENT>difference = sorted(difference)<EOL><DEDENT>if len(difference) == <NUM_LIT:0>:<EOL><INDENT>return MultiIndex(levels=[[]] * self.nlevels,<EOL>codes=[[]] * self.nlevels,<EOL>names=result_names, verify_integrity=False)<EOL><DEDENT>else:<EOL><INDENT>return MultiIndex.from_tuples(difference, sortorder=<NUM_LIT:0>,<EOL>names=result_names)<EOL><DEDENT>
Compute set difference of two MultiIndex objects

Parameters
----------
other : MultiIndex
sort : False or None, default None
    Sort the resulting MultiIndex if possible

    .. versionadded:: 0.24.0

    .. versionchanged:: 0.24.1

       Changed the default value from ``True`` to ``None``
       (without change in behaviour).

Returns
-------
diff : MultiIndex