nodes: 0, module; 1, function_definition; 2, function_name:_get_combined_index; 3, parameters; 4, block; 5, identifier:indexes; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, comment:# TODO: handle index names!; 10, expression_statement; 11, if_statement; 12, if_statement; 13, return_statement; 14, identifier:intersect; 15, False; 16, identifier:sort; 17, False; 18, comment:"""
      Return the union or intersection of indexes.
  
      Parameters
      ----------
      indexes : list of Index or list objects
          When intersect=True, do not accept list of lists.
      intersect : bool, default False
          If True, calculate the intersection between indexes. Otherwise,
          calculate the union.
      sort : bool, default False
          Whether the result index should come out sorted or not.
  
      Returns
      -------
      Index
      """; 19, assignment; 20, comparison_operator:len(indexes) == 0; 21, block; 22, elif_clause; 23, elif_clause; 24, else_clause; 25, identifier:sort; 26, block; 27, identifier:index; 28, identifier:indexes; 29, call; 30, call; 31, integer:0; 32, expression_statement; 33, comparison_operator:len(indexes) == 1; 34, block; 35, identifier:intersect; 36, block; 37, block; 38, try_statement; 39, identifier:_get_distinct_objs; 40, argument_list; 41, identifier:len; 42, argument_list; 43, assignment; 44, call; 45, integer:1; 46, expression_statement; 47, expression_statement; 48, for_statement; 49, expression_statement; 50, expression_statement; 51, block; 52, except_clause; 53, identifier:indexes; 54, identifier:indexes; 55, identifier:index; 56, call; 57, identifier:len; 58, argument_list; 59, assignment; 60, assignment; 61, identifier:other; 62, subscript; 63, block; 64, assignment; 65, assignment; 66, expression_statement; 67, identifier:TypeError; 68, block; 69, identifier:Index; 70, argument_list; 71, identifier:indexes; 72, identifier:index; 73, subscript; 74, identifier:index; 75, subscript; 76, identifier:indexes; 77, slice; 78, expression_statement; 79, identifier:index; 80, call; 81, identifier:index; 82, call; 83, assignment; 84, pass_statement; 85, list; 86, identifier:indexes; 87, integer:0; 88, identifier:indexes; 89, integer:0; 90, integer:1; 91, assignment; 92, identifier:_union_indexes; 93, argument_list; 94, identifier:ensure_index; 95, argument_list; 96, identifier:index; 97, call; 98, identifier:index; 99, call; 100, identifier:indexes; 101, keyword_argument; 102, identifier:index; 103, attribute; 104, argument_list; 105, attribute; 106, argument_list; 107, identifier:sort; 108, identifier:sort; 109, identifier:index; 110, identifier:sort_values; 111, identifier:index; 112, identifier:intersection; 113, identifier:other
code: def _get_combined_index(indexes, intersect=False, sort=False):
      """
      Return the union or intersection of indexes.
  
      Parameters
      ----------
      indexes : list of Index or list objects
          When intersect=True, do not accept list of lists.
      intersect : bool, default False
          If True, calculate the intersection between indexes. Otherwise,
          calculate the union.
      sort : bool, default False
          Whether the result index should come out sorted or not.
  
      Returns
      -------
      Index
      """
  
      # TODO: handle index names!
      indexes = _get_distinct_objs(indexes)
      if len(indexes) == 0:
          index = Index([])
      elif len(indexes) == 1:
          index = indexes[0]
      elif intersect:
          index = indexes[0]
          for other in indexes[1:]:
              index = index.intersection(other)
      else:
          index = _union_indexes(indexes, sort=sort)
          index = ensure_index(index)
  
      if sort:
          try:
              index = index.sort_values()
          except TypeError:
              pass
      return index