code: def _convert_to_array_indexer(
      indexer: indexing.NDIndexer,
  ) -> tuple[int | Array, ...]:
      # This is the general gather case. We need to create the gather arrays.
      (
          is_integer_indexer,
          _,
          integer_indexer,
      ) = indexing.unpack_ndindexer(indexer)
      total_shape = indexer.get_indexer_shape()
      int_indexer_shape = indexer.int_indexer_shape
      slice_shape = total_shape[len(int_indexer_shape) :]
      slice_dims = tuple(
          i + len(int_indexer_shape) for i in range(len(slice_shape))
      )
      slice_dim_iter = iter(slice_dims)
      slice_indexer: list[Array] = []
      for idx, is_int_index in zip(indexer.indices, is_integer_indexer):
          if not is_int_index:
              assert isinstance(idx, indexing.Slice)
              slice_indices = (
                  lax.broadcasted_iota(
                      np.dtype("int32"),
                      total_shape,
                      next(slice_dim_iter),
                  )
                  + idx.start
              )
              slice_indexer.append(slice_indices)
              integer_indexer = tuple(
                  lax.expand_dims(idx, (-1,)) for idx in integer_indexer
              )
              continue
      assert next(slice_dim_iter, None) is None
      return tuple(
          merge_lists(
              is_integer_indexer, slice_indexer, integer_indexer
          )
      )
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  import dataclasses
  from functools import partial
  import operator
  from typing import Any, Callable, Protocol
  import numpy
  from jax._src import api_util
  from jax._src import ad_util
  from jax._src import config
  from jax._src import core
  from jax._src import linear_util
  from jax._src import source_info_util
  from jax._src import tree_util
  from jax._src.interpreters import ad
  from jax._src.interpreters import mlir
  from jax._src.interpreters import partial_eval
  from jax._src.lax import lax
  from jax._src.lax import slicing
  from jax._src.state import indexing
  from jax._src.state.types import AbstractRef, RefEffect
  from jax._src.state.primitives import get_p, swap_p, addupdate_p
  from jax._src.state.utils import hoist_consts_to_refs
  from jax._src.typing import Array
  from jax._src.util import safe_map, safe_zip, split_list, weakref_lru_cache, partition_list, merge_lists, split_dict
label_desc: Use image node_id 6 for calling a global function with example usage: _convert_to_array_indexer(indexer) and returns: tuple