nodes: 0, module; 1, function_definition; 2, function_name:union; 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, comment:# TODO: Index.union returns other when `len(self)` is 0.; 14, expression_statement; 15, return_statement; 16, identifier:sort; 17, None; 18, comment:"""
          Form the union of two MultiIndex objects
  
          Parameters
          ----------
          other : MultiIndex or array / Index of tuples
          sort : False or None, default None
              Whether to sort the resulting Index.
  
              * None : Sort the result, except when
  
                1. `self` and `other` are equal.
                2. `self` has length 0.
                3. Some values in `self` or `other` cannot be compared.
                   A RuntimeWarning is issued in this case.
  
              * False : do not sort the result.
  
              .. versionadded:: 0.24.0
  
              .. versionchanged:: 0.24.1
  
                 Changed the default value from ``True`` to ``None``
                 (without change in behaviour).
  
          Returns
          -------
          Index
  
          >>> index.union(index2)
          """; 19, call; 20, call; 21, assignment; 22, boolean_operator; 23, block; 24, assignment; 25, call; 26, attribute; 27, argument_list; 28, attribute; 29, argument_list; 30, pattern_list; 31, call; 32, comparison_operator:len(other) == 0; 33, call; 34, return_statement; 35, identifier:uniq_tuples; 36, call; 37, attribute; 38, argument_list; 39, identifier:self; 40, identifier:_validate_sort_keyword; 41, identifier:sort; 42, identifier:self; 43, identifier:_assert_can_do_setop; 44, identifier:other; 45, identifier:other; 46, identifier:result_names; 47, attribute; 48, argument_list; 49, call; 50, integer:0; 51, attribute; 52, argument_list; 53, identifier:self; 54, attribute; 55, argument_list; 56, identifier:MultiIndex; 57, identifier:from_arrays; 58, call; 59, keyword_argument; 60, keyword_argument; 61, identifier:self; 62, identifier:_convert_can_do_setop; 63, identifier:other; 64, identifier:len; 65, argument_list; 66, identifier:self; 67, identifier:equals; 68, identifier:other; 69, identifier:lib; 70, identifier:fast_unique_multiple; 71, list; 72, keyword_argument; 73, identifier:lzip; 74, argument_list; 75, identifier:sortorder; 76, integer:0; 77, identifier:names; 78, identifier:result_names; 79, identifier:other; 80, attribute; 81, attribute; 82, identifier:sort; 83, identifier:sort; 84, list_splat; 85, identifier:self; 86, identifier:_ndarray_values; 87, identifier:other; 88, identifier:_ndarray_values; 89, identifier:uniq_tuples
code: def union(self, other, sort=None):
          """
          Form the union of two MultiIndex objects
  
          Parameters
          ----------
          other : MultiIndex or array / Index of tuples
          sort : False or None, default None
              Whether to sort the resulting Index.
  
              * None : Sort the result, except when
  
                1. `self` and `other` are equal.
                2. `self` has length 0.
                3. Some values in `self` or `other` cannot be compared.
                   A RuntimeWarning is issued in this case.
  
              * False : do not sort the result.
  
              .. versionadded:: 0.24.0
  
              .. versionchanged:: 0.24.1
  
                 Changed the default value from ``True`` to ``None``
                 (without change in behaviour).
  
          Returns
          -------
          Index
  
          >>> index.union(index2)
          """
          self._validate_sort_keyword(sort)
          self._assert_can_do_setop(other)
          other, result_names = self._convert_can_do_setop(other)
  
          if len(other) == 0 or self.equals(other):
              return self
  
          # TODO: Index.union returns other when `len(self)` is 0.
  
          uniq_tuples = lib.fast_unique_multiple([self._ndarray_values,
                                                  other._ndarray_values],
                                                 sort=sort)
  
          return MultiIndex.from_arrays(lzip(*uniq_tuples), sortorder=0,
                                        names=result_names)