nodes: 0, module; 1, function_definition; 2, function_name:_union_indexes; 3, parameters; 4, block; 5, identifier:indexes; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, function_definition; 12, if_statement; 13, identifier:sort; 14, True; 15, comment:"""
      Return the union of indexes.
  
      The behavior of sort and names is not consistent.
  
      Parameters
      ----------
      indexes : list of Index or list objects
      sort : bool, default True
          Whether the result index should come out sorted or not.
  
      Returns
      -------
      Index
      """; 16, comparison_operator:len(indexes) == 0; 17, block; 18, comparison_operator:len(indexes) == 1; 19, block; 20, assignment; 21, function_name:_unique_indices; 22, parameters; 23, block; 24, comparison_operator:kind == 'special'; 25, block; 26, elif_clause; 27, else_clause; 28, call; 29, integer:0; 30, raise_statement; 31, call; 32, integer:1; 33, expression_statement; 34, if_statement; 35, return_statement; 36, pattern_list; 37, call; 38, identifier:inds; 39, expression_statement; 40, function_definition; 41, return_statement; 42, identifier:kind; 43, string; 44, expression_statement; 45, if_statement; 46, comparison_operator:kind == 'array'; 47, block; 48, comment:# kind='list'; 49, block; 50, identifier:len; 51, argument_list; 52, call; 53, identifier:len; 54, argument_list; 55, assignment; 56, call; 57, block; 58, identifier:result; 59, identifier:indexes; 60, identifier:kind; 61, identifier:_sanitize_and_check; 62, argument_list; 63, comment:"""
          Convert indexes to lists and concatenate them, removing duplicates.
  
          The final dtype is inferred.
  
          Parameters
          ----------
          inds : list of Index or list objects
  
          Returns
          -------
          Index
          """; 64, function_name:conv; 65, parameters; 66, block; 67, call; 68, string_content:special; 69, assignment; 70, call; 71, block; 72, else_clause; 73, identifier:kind; 74, string; 75, expression_statement; 76, for_statement; 77, expression_statement; 78, if_statement; 79, return_statement; 80, return_statement; 81, identifier:indexes; 82, identifier:AssertionError; 83, argument_list; 84, identifier:indexes; 85, identifier:result; 86, subscript; 87, identifier:isinstance; 88, argument_list; 89, expression_statement; 90, identifier:indexes; 91, identifier:i; 92, if_statement; 93, return_statement; 94, identifier:Index; 95, argument_list; 96, identifier:result; 97, subscript; 98, identifier:hasattr; 99, argument_list; 100, return_statement; 101, block; 102, string_content:array; 103, assignment; 104, identifier:other; 105, subscript; 106, block; 107, assignment; 108, comparison_operator:name != index.name; 109, block; 110, identifier:index; 111, call; 112, string; 113, identifier:indexes; 114, integer:0; 115, identifier:result; 116, identifier:list; 117, assignment; 118, call; 119, block; 120, identifier:i; 121, call; 122, identifier:indexes; 123, integer:0; 124, identifier:result; 125, string; 126, call; 127, for_statement; 128, return_statement; 129, identifier:index; 130, subscript; 131, identifier:indexes; 132, slice; 133, if_statement; 134, identifier:name; 135, subscript; 136, identifier:name; 137, attribute; 138, expression_statement; 139, identifier:_unique_indices; 140, argument_list; 141, string_content:Must have at least 1 Index to union; 142, identifier:result; 143, call; 144, identifier:isinstance; 145, argument_list; 146, expression_statement; 147, attribute; 148, argument_list; 149, string_content:union_many; 150, attribute; 151, argument_list; 152, identifier:other; 153, subscript; 154, block; 155, identifier:result; 156, identifier:indexes; 157, integer:0; 158, integer:1; 159, not_operator; 160, block; 161, call; 162, integer:0; 163, identifier:index; 164, identifier:name; 165, assignment; 166, identifier:indexes; 167, identifier:Index; 168, argument_list; 169, identifier:i; 170, identifier:Index; 171, assignment; 172, identifier:lib; 173, identifier:fast_unique_multiple_list; 174, list_comprehension; 175, keyword_argument; 176, identifier:result; 177, identifier:union_many; 178, subscript; 179, identifier:indexes; 180, slice; 181, expression_statement; 182, call; 183, if_statement; 184, return_statement; 185, identifier:_get_consensus_names; 186, argument_list; 187, identifier:index; 188, call; 189, call; 190, identifier:i; 191, call; 192, call; 193, for_in_clause; 194, identifier:sort; 195, identifier:sort; 196, identifier:indexes; 197, slice; 198, integer:1; 199, assignment; 200, attribute; 201, argument_list; 202, comparison_operator:sort is None; 203, comment:# TODO: remove once pd.concat sort default changes; 204, block; 205, call; 206, identifier:indexes; 207, attribute; 208, argument_list; 209, identifier:sorted; 210, argument_list; 211, attribute; 212, argument_list; 213, identifier:conv; 214, argument_list; 215, identifier:i; 216, identifier:inds; 217, integer:1; 218, identifier:result; 219, call; 220, identifier:index; 221, identifier:equals; 222, identifier:other; 223, identifier:sort; 224, None; 225, expression_statement; 226, expression_statement; 227, identifier:_unique_indices; 228, argument_list; 229, identifier:index; 230, identifier:_shallow_copy; 231, keyword_argument; 232, identifier:result; 233, identifier:i; 234, identifier:tolist; 235, identifier:i; 236, attribute; 237, argument_list; 238, call; 239, assignment; 240, identifier:indexes; 241, identifier:name; 242, identifier:name; 243, identifier:result; 244, identifier:union; 245, identifier:other; 246, attribute; 247, argument_list; 248, identifier:sort; 249, True; 250, identifier:warnings; 251, identifier:warn; 252, identifier:_sort_msg; 253, identifier:FutureWarning; 254, keyword_argument; 255, identifier:stacklevel; 256, integer:8
code: def _union_indexes(indexes, sort=True):
      """
      Return the union of indexes.
  
      The behavior of sort and names is not consistent.
  
      Parameters
      ----------
      indexes : list of Index or list objects
      sort : bool, default True
          Whether the result index should come out sorted or not.
  
      Returns
      -------
      Index
      """
      if len(indexes) == 0:
          raise AssertionError('Must have at least 1 Index to union')
      if len(indexes) == 1:
          result = indexes[0]
          if isinstance(result, list):
              result = Index(sorted(result))
          return result
  
      indexes, kind = _sanitize_and_check(indexes)
  
      def _unique_indices(inds):
          """
          Convert indexes to lists and concatenate them, removing duplicates.
  
          The final dtype is inferred.
  
          Parameters
          ----------
          inds : list of Index or list objects
  
          Returns
          -------
          Index
          """
          def conv(i):
              if isinstance(i, Index):
                  i = i.tolist()
              return i
  
          return Index(
              lib.fast_unique_multiple_list([conv(i) for i in inds], sort=sort))
  
      if kind == 'special':
          result = indexes[0]
  
          if hasattr(result, 'union_many'):
              return result.union_many(indexes[1:])
          else:
              for other in indexes[1:]:
                  result = result.union(other)
              return result
      elif kind == 'array':
          index = indexes[0]
          for other in indexes[1:]:
              if not index.equals(other):
  
                  if sort is None:
                      # TODO: remove once pd.concat sort default changes
                      warnings.warn(_sort_msg, FutureWarning, stacklevel=8)
                      sort = True
  
                  return _unique_indices(indexes)
  
          name = _get_consensus_names(indexes)[0]
          if name != index.name:
              index = index._shallow_copy(name=name)
          return index
      else:  # kind='list'
          return _unique_indices(indexes)