nodes: 0, module; 1, function_definition; 2, function_name:difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, if_statement; 20, if_statement; 21, identifier:sort; 22, None; 23, comment:"""
          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
          """; 24, call; 25, call; 26, assignment; 27, comparison_operator:len(other) == 0; 28, block; 29, call; 30, block; 31, assignment; 32, assignment; 33, assignment; 34, assignment; 35, assignment; 36, comparison_operator:sort is None; 37, block; 38, comparison_operator:len(difference) == 0; 39, block; 40, else_clause; 41, attribute; 42, argument_list; 43, attribute; 44, argument_list; 45, pattern_list; 46, call; 47, call; 48, integer:0; 49, return_statement; 50, attribute; 51, argument_list; 52, return_statement; 53, identifier:this; 54, call; 55, identifier:indexer; 56, call; 57, identifier:indexer; 58, call; 59, identifier:label_diff; 60, call; 61, identifier:difference; 62, call; 63, identifier:sort; 64, None; 65, expression_statement; 66, call; 67, integer:0; 68, return_statement; 69, block; 70, identifier:self; 71, identifier:_validate_sort_keyword; 72, identifier:sort; 73, identifier:self; 74, identifier:_assert_can_do_setop; 75, identifier:other; 76, identifier:other; 77, identifier:result_names; 78, attribute; 79, argument_list; 80, identifier:len; 81, argument_list; 82, identifier:self; 83, identifier:self; 84, identifier:equals; 85, identifier:other; 86, call; 87, attribute; 88, argument_list; 89, attribute; 90, argument_list; 91, attribute; 92, argument_list; 93, attribute; 94, argument_list; 95, attribute; 96, argument_list; 97, assignment; 98, identifier:len; 99, argument_list; 100, call; 101, return_statement; 102, identifier:self; 103, identifier:_convert_can_do_setop; 104, identifier:other; 105, identifier:other; 106, identifier:MultiIndex; 107, argument_list; 108, identifier:self; 109, identifier:_get_unique_index; 110, identifier:this; 111, identifier:get_indexer; 112, identifier:other; 113, identifier:indexer; 114, identifier:take; 115, subscript; 116, identifier:np; 117, identifier:setdiff1d; 118, call; 119, identifier:indexer; 120, keyword_argument; 121, attribute; 122, identifier:take; 123, identifier:label_diff; 124, identifier:difference; 125, call; 126, identifier:difference; 127, identifier:MultiIndex; 128, argument_list; 129, call; 130, keyword_argument; 131, keyword_argument; 132, keyword_argument; 133, keyword_argument; 134, call; 135, integer:0; 136, attribute; 137, argument_list; 138, identifier:assume_unique; 139, True; 140, identifier:this; 141, identifier:values; 142, identifier:sorted; 143, argument_list; 144, keyword_argument; 145, keyword_argument; 146, keyword_argument; 147, keyword_argument; 148, attribute; 149, argument_list; 150, identifier:levels; 151, attribute; 152, identifier:codes; 153, binary_operator:[[]] * self.nlevels; 154, identifier:names; 155, identifier:result_names; 156, identifier:verify_integrity; 157, False; 158, attribute; 159, argument_list; 160, identifier:np; 161, identifier:arange; 162, attribute; 163, identifier:difference; 164, identifier:levels; 165, binary_operator:[[]] * self.nlevels; 166, identifier:codes; 167, binary_operator:[[]] * self.nlevels; 168, identifier:names; 169, identifier:result_names; 170, identifier:verify_integrity; 171, False; 172, identifier:MultiIndex; 173, identifier:from_tuples; 174, identifier:difference; 175, keyword_argument; 176, keyword_argument; 177, identifier:self; 178, identifier:levels; 179, list; 180, attribute; 181, parenthesized_expression; 182, identifier:nonzero; 183, identifier:this; 184, identifier:size; 185, list; 186, attribute; 187, list; 188, attribute; 189, identifier:sortorder; 190, integer:0; 191, identifier:names; 192, identifier:result_names; 193, list; 194, identifier:self; 195, identifier:nlevels; 196, comparison_operator:indexer != -1; 197, list; 198, identifier:self; 199, identifier:nlevels; 200, list; 201, identifier:self; 202, identifier:nlevels; 203, identifier:indexer; 204, unary_operator; 205, integer:1
code: def difference(self, other, sort=None):
          """
          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
          """
          self._validate_sort_keyword(sort)
          self._assert_can_do_setop(other)
          other, result_names = self._convert_can_do_setop(other)
  
          if len(other) == 0:
              return self
  
          if self.equals(other):
              return MultiIndex(levels=self.levels,
                                codes=[[]] * self.nlevels,
                                names=result_names, verify_integrity=False)
  
          this = self._get_unique_index()
  
          indexer = this.get_indexer(other)
          indexer = indexer.take((indexer != -1).nonzero()[0])
  
          label_diff = np.setdiff1d(np.arange(this.size), indexer,
                                    assume_unique=True)
          difference = this.values.take(label_diff)
          if sort is None:
              difference = sorted(difference)
  
          if len(difference) == 0:
              return MultiIndex(levels=[[]] * self.nlevels,
                                codes=[[]] * self.nlevels,
                                names=result_names, verify_integrity=False)
          else:
              return MultiIndex.from_tuples(difference, sortorder=0,
                                            names=result_names)