def _get_combined_index(indexes, intersect=False, sort=False):
<EOL>indexes = _get_distinct_objs(indexes)<EOL>if len(indexes) == <NUM_LIT:0>:<EOL><INDENT>index = Index([])<EOL><DEDENT>elif len(indexes) == <NUM_LIT:1>:<EOL><INDENT>index = indexes[<NUM_LIT:0>]<EOL><DEDENT>elif intersect:<EOL><INDENT>index = indexes[<NUM_LIT:0>]<EOL>for other in indexes[<NUM_LIT:1>:]:<EOL><INDENT>index = index.intersection(other)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>index = _union_indexes(indexes, sort=sort)<EOL>index = ensure_index(index)<EOL><DEDENT>if sort:<EOL><INDENT>try:<EOL><INDENT>index = index.sort_values()<EOL><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return index<EOL>
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