code: def indices(
      shape: Shape,
      *,
      min_dims: int = 0,
      max_dims: Optional[int] = None,
      allow_newaxis: bool = False,
      allow_ellipsis: bool = True,
  ) -> st.SearchStrategy[BasicIndex]:
      """Return a strategy for :xp-ref:`valid indices <indexing.html>` of
      arrays with the specified shape, which may include dimensions of size zero.
  
      It generates tuples containing some mix of integers, :obj:`python:slice`
      objects, ``...`` (an ``Ellipsis``), and ``None``. When a length-one tuple
      would be generated, this strategy may instead return the element which will
      index the first axis, e.g. ``5`` instead of ``(5,)``.
  
      * ``shape`` is the shape of the array that will be indexed, as a tuple of
        integers >= 0. This must be at least two-dimensional for a tuple to be a
        valid index;  for one-dimensional arrays use
        :func:`~hypothesis.strategies.slices` instead.
      * ``min_dims`` is the minimum dimensionality of the resulting array from use
        of the generated index.
      * ``max_dims`` is the the maximum dimensionality of the resulting array,
        defaulting to ``len(shape) if not allow_newaxis else
        max(len(shape), min_dims) + 2``.
      * ``allow_ellipsis`` specifies whether ``None`` is allowed in the index.
      * ``allow_ellipsis`` specifies whether ``...`` is allowed in the index.
      """
      check_type(tuple, shape, "shape")
      check_argument(
          all(isinstance(x, int) and x >= 0 for x in shape),
          f"{shape=}, but all dimensions must be non-negative integers.",
      )
      check_type(bool, allow_newaxis, "allow_newaxis")
      check_type(bool, allow_ellipsis, "allow_ellipsis")
      check_type(int, min_dims, "min_dims")
      if not allow_newaxis:
          check_argument(
              min_dims <= len(shape),
              f"min_dims={min_dims} is larger than len(shape)={len(shape)}, "
              "but it is impossible for an indexing operation to add dimensions ",
              "when allow_newaxis=False.",
          )
      check_valid_dims(min_dims, "min_dims")
  
      if max_dims is None:
          if allow_newaxis:
              max_dims = min(max(len(shape), min_dims) + 2, NDIM_MAX)
          else:
              max_dims = min(len(shape), NDIM_MAX)
      check_type(int, max_dims, "max_dims")
      assert isinstance(max_dims, int)
      if not allow_newaxis:
          check_argument(
              max_dims <= len(shape),
              f"max_dims={max_dims} is larger than len(shape)={len(shape)}, "
              "but it is impossible for an indexing operation to add dimensions ",
              "when allow_newaxis=False.",
          )
      check_valid_dims(max_dims, "max_dims")
  
      order_check("dims", 0, min_dims, max_dims)
  
      return BasicIndexStrategy(
          shape,
          min_dims=min_dims,
          max_dims=max_dims,
          allow_ellipsis=allow_ellipsis,
          allow_newaxis=allow_newaxis,
          allow_fewer_indices_than_dims=False,
      )
  
imports: import math
  import sys
  from numbers import Real
  from types import SimpleNamespace
  from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Literal, Mapping, NamedTuple, Optional, Sequence, Tuple, Type, TypeVar, Union, get_args
  from warnings import warn
  from weakref import WeakValueDictionary
  from hypothesis import strategies
  from hypothesis.errors import HypothesisWarning, InvalidArgument
  from hypothesis.extra._array_helpers import NDIM_MAX, BasicIndex, BasicIndexStrategy, BroadcastableShapes, Shape, array_shapes, broadcastable_shapes, check_argument, check_valid_dims, mutually_broadcastable_shapes, order_check, valid_tuple_axes
  from hypothesis.internal.conjecture import utils
  from hypothesis.internal.coverage import check_function
  from hypothesis.internal.floats import next_down
  from hypothesis.internal.reflection import proxies
  from hypothesis.internal.validation import check_type, check_valid_bound, check_valid_integer, check_valid_interval
  from hypothesis.strategies._internal.strategies import check_strategy
  from hypothesis.strategies._internal.utils import defines_strategy
label_desc: Use image node_id 21 for calling a global function with example usage: indices(shape) and returns: BasicIndexStrategy