code: def do_draw(self, data):
      # General plan: determine the actual selection up front with a straightforward
      # approach that shrinks well, then complicate it by inserting other things.
      result = []
      for dim_size in self.shape:
          if dim_size == 0:
              result.append(slice(None))
              continue
          strategy = st.integers(-dim_size, dim_size - 1) | st.slices(
              dim_size
          )
          result.append(data.draw(strategy))
      # Insert some number of new size-one dimensions if allowed
      result_dims = sum(isinstance(idx, slice) for idx in result)
      while (
          self.allow_newaxis
          and result_dims < self.max_dims
          and (result_dims < self.min_dims or data.draw(st.booleans()))
      ):
          result.insert(
              data.draw(st.integers(0, len(result))), np.newaxis
          )
          result_dims += 1
      # Check that we'll have the right number of dimensions; reject if not.
      # It's easy to do this by construction iff you don't care about shrinking,
      # which is really important for array shapes.  So we filter instead.
      assume(self.min_dims <= result_dims <= self.max_dims)
      # This is a quick-and-dirty way to insert ..., xor shorten the indexer,
      # but it means we don't have to do any structural analysis.
      if self.allow_ellipsis and data.draw(st.booleans()):
          # Choose an index; then replace all adjacent whole-dimension slices.
          i = j = data.draw(st.integers(0, len(result)))
          while i > 0 and result[i - 1] == slice(None):
              i -= 1
          while j < len(result) and result[j] == slice(None):
              j += 1
          result[i:j] = [Ellipsis]
      else:
          while result[-1:] == [slice(None, None)] and data.draw(
              st.integers(0, 7)
          ):
              result.pop()
      return tuple(result)
  
imports: from __future__ import absolute_import, division, print_function
  import math
  import re
  from collections import namedtuple
  import numpy
  import hypothesis.internal.conjecture.utils
  import hypothesis.strategies._internal.core
  from hypothesis import Verbosity, assume
  from hypothesis._settings import note_deprecation
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.compat import PY2, hrange, integer_types, quiet_raise, string_types
  from hypothesis.internal.coverage import check_function
  from hypothesis.internal.reflection import proxies, reserved_means_kwonly_star
  from hypothesis.internal.validation import check_type, check_valid_interval
  from hypothesis.reporting import current_verbosity
  from hypothesis.strategies._internal import SearchStrategy
  from hypothesis.utils.conventions import UniqueIdentifier, not_set
label_desc: Use image node_id 2 for calling the BasicIndexStrategy obj's underlying member method code with example usage: obj.do_draw(data) and returns: tuple