code: def basic_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 :doc:`basic indexes <numpy:reference/arrays.indexing>` 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
        positive integers. 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. When ``min_dims == 0``, scalars and zero-dimensional
        arrays are both allowed.
      * ``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_newaxis`` specifies whether ``None`` is allowed in the index.
      * ``allow_ellipsis`` specifies whether ``...`` is allowed in the index.
      """
      # Arguments to exclude scalars, zero-dim arrays, and dims of size zero were
      # all considered and rejected.  We want users to explicitly consider those
      # cases if they're dealing in general indexers, and while it's fiddly we can
      # back-compatibly add them later (hence using kwonlyargs).
      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_ellipsis, "allow_ellipsis")
      check_type(bool, allow_newaxis, "allow_newaxis")
      check_type(int, min_dims, "min_dims")
      if min_dims > len(shape) and not allow_newaxis:
          note_deprecation(
              f"min_dims={min_dims} is larger than len(shape)={len(shape)}, "
              "but allow_newaxis=False makes it impossible for an indexing "
              "operation to add dimensions.",
              since="2021-09-15",
              has_codemod=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)
      else:
          check_type(int, max_dims, "max_dims")
          if max_dims > len(shape) and not allow_newaxis:
              note_deprecation(
                  f"max_dims={max_dims} is larger than len(shape)={len(shape)}, "
                  "but allow_newaxis=False makes it impossible for an indexing "
                  "operation to add dimensions.",
                  since="2021-09-15",
                  has_codemod=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=True,
      )
  
imports: import importlib
  import math
  from typing import TYPE_CHECKING, Any, Literal, Mapping, Optional, Sequence, Tuple, Type, TypeVar, Union
  import numpy
  from hypothesis import strategies
  from hypothesis._settings import note_deprecation
  from hypothesis.errors import HypothesisException, 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.reflection import proxies
  from hypothesis.internal.validation import check_type
  from hypothesis.strategies._internal.numbers import Real
  from hypothesis.strategies._internal.strategies import Ex, T, check_strategy
  from hypothesis.strategies._internal.utils import defines_strategy
label_desc: Use image node_id 23 for calling a global function with example usage: basic_indices(shape) and returns: BasicIndexStrategy