code: def make_strategies_namespace(
      xp: Any, *, api_version: Optional[NominalVersion] = None
  ) -> SimpleNamespace:
      """Creates a strategies namespace for the given array module.
  
      * ``xp`` is the Array API library to automatically pass to the namespaced methods.
      * ``api_version`` is the version of the Array API which the returned
        strategies namespace should conform to. If ``None``, the latest API
        version which ``xp`` supports will be inferred from ``xp.__array_api_version__``.
        If a version string in the ``YYYY.MM`` format, the strategies namespace
        will conform to that version if supported.
  
      A :obj:`python:types.SimpleNamespace` is returned which contains all the
      strategy methods in this module but without requiring the ``xp`` argument.
      Creating and using a strategies namespace for NumPy's Array API
      implementation would go like this:
  
      .. code-block:: pycon
  
        >>> xp.__array_api_version__  # xp is your desired array library
        '2021.12'
        >>> xps = make_strategies_namespace(xp)
        >>> xps.api_version
        '2021.12'
        >>> x = xps.arrays(xp.int8, (2, 3)).example()
        >>> x
        Array([[-8,  6,  3],
               [-6,  4,  6]], dtype=int8)
        >>> x.__array_namespace__() is xp
        True
  
      """
      not_available_msg = (
          "If the standard version you want is not available, please ensure "
          "you're using the latest version of Hypothesis, then open an issue if "
          "one doesn't already exist."
      )
      if api_version is None:
          check_argument(
              hasattr(xp, "__array_api_version__"),
              f"Array module {xp.__name__} has no attribute __array_api_version__, "
              "which is required when inferring api_version. If you believe "
              f"{xp.__name__} is indeed an Array API module, try explicitly "
              "passing an api_version.",
          )
          check_argument(
              isinstance(xp.__array_api_version__, str)
              and xp.__array_api_version__ in RELEASED_VERSIONS,
              f"{xp.__array_api_version__=}, but it must "
              f"be a valid version string {RELEASED_VERSIONS}. {not_available_msg}",
          )
          api_version = xp.__array_api_version__
          inferred_version = True
      else:
          check_argument(
              isinstance(api_version, str)
              and api_version in NOMINAL_VERSIONS,
              f"{api_version=}, but it must be None, or a valid version "
              f"string in {RELEASED_VERSIONS}. {not_available_msg}",
          )
          inferred_version = False
      try:
          array = xp.zeros(1)
          array.__array_namespace__()
      except Exception:
          warn(
              f"Could not determine whether module {xp.__name__} is an Array API library",
              HypothesisWarning,
              stacklevel=2,
          )
  
      try:
          namespace = _args_to_xps[(xp, api_version)]
      except (KeyError, TypeError):
          pass
      else:
          return namespace
  
      @defines_strategy(force_reusable_values=True)
      def from_dtype(
          dtype: Union[DataType, str],
          *,
          min_value: Optional[Union[int, float]] = None,
          max_value: Optional[Union[int, float]] = None,
          allow_nan: Optional[bool] = None,
          allow_infinity: Optional[bool] = None,
          allow_subnormal: Optional[bool] = None,
          exclude_min: Optional[bool] = None,
          exclude_max: Optional[bool] = None,
      ) -> st.SearchStrategy[Union[bool, int, float, complex]]:
          return _from_dtype(
              xp,
              api_version,
              dtype,
              min_value=min_value,
              max_value=max_value,
              allow_nan=allow_nan,
              allow_infinity=allow_infinity,
              allow_subnormal=allow_subnormal,
              exclude_min=exclude_min,
              exclude_max=exclude_max,
          )
  
      @defines_strategy(force_reusable_values=True)
      def arrays(
          dtype: Union[
              DataType,
              str,
              st.SearchStrategy[DataType],
              st.SearchStrategy[str],
          ],
          shape: Union[int, Shape, st.SearchStrategy[Shape]],
          *,
          elements: Optional[
              Union[Mapping[str, Any], st.SearchStrategy]
          ] = None,
          fill: Optional[st.SearchStrategy[Any]] = None,
          unique: bool = False,
      ) -> st.SearchStrategy:
          return _arrays(
              xp,
              api_version,
              dtype,
              shape,
              elements=elements,
              fill=fill,
              unique=unique,
          )
  
      @defines_strategy()
      def scalar_dtypes() -> st.SearchStrategy[DataType]:
          return _scalar_dtypes(xp, api_version)
  
      @defines_strategy()
      def boolean_dtypes() -> st.SearchStrategy[DataType]:
          return _boolean_dtypes(xp)
  
      @defines_strategy()
      def real_dtypes() -> st.SearchStrategy[DataType]:
          return _real_dtypes(xp)
  
      @defines_strategy()
      def numeric_dtypes() -> st.SearchStrategy[DataType]:
          return _numeric_dtypes(xp, api_version)
  
      @defines_strategy()
      def integer_dtypes(
          *, sizes: Union[IntSize, Sequence[IntSize]] = (8, 16, 32, 64)
      ) -> st.SearchStrategy[DataType]:
          return _integer_dtypes(xp, sizes=sizes)
  
      @defines_strategy()
      def unsigned_integer_dtypes(
          *, sizes: Union[IntSize, Sequence[IntSize]] = (8, 16, 32, 64)
      ) -> st.SearchStrategy[DataType]:
          return _unsigned_integer_dtypes(xp, sizes=sizes)
  
      @defines_strategy()
      def floating_dtypes(
          *, sizes: Union[FltSize, Sequence[FltSize]] = (32, 64)
      ) -> st.SearchStrategy[DataType]:
          return _floating_dtypes(xp, sizes=sizes)
  
      from_dtype.__doc__ = _from_dtype.__doc__
      arrays.__doc__ = _arrays.__doc__
      scalar_dtypes.__doc__ = _scalar_dtypes.__doc__
      boolean_dtypes.__doc__ = _boolean_dtypes.__doc__
      real_dtypes.__doc__ = _real_dtypes.__doc__
      numeric_dtypes.__doc__ = _numeric_dtypes.__doc__
      integer_dtypes.__doc__ = _integer_dtypes.__doc__
      unsigned_integer_dtypes.__doc__ = _unsigned_integer_dtypes.__doc__
      floating_dtypes.__doc__ = _floating_dtypes.__doc__
  
      class StrategiesNamespace(SimpleNamespace):
          def __init__(self, **kwargs):
              for attr in ["name", "api_version"]:
                  if attr not in kwargs:
                      raise ValueError(f"'{attr}' kwarg required")
              super().__init__(**kwargs)
  
          @property
          def complex_dtypes(self):
              try:
                  return self.__dict__["complex_dtypes"]
              except KeyError as e:
                  raise AttributeError(
                      "You attempted to access 'complex_dtypes', but it is not "
                      f"available for api_version='{self.api_version}' of "
                      f"xp={self.name}."
                  ) from e
  
          def __repr__(self):
              f_args = self.name
              if not inferred_version:
                  f_args += f", api_version='{self.api_version}'"
              return f"make_strategies_namespace({f_args})"
  
      kwargs = dict(
          name=xp.__name__,
          api_version=api_version,
          from_dtype=from_dtype,
          arrays=arrays,
          array_shapes=array_shapes,
          scalar_dtypes=scalar_dtypes,
          boolean_dtypes=boolean_dtypes,
          real_dtypes=real_dtypes,
          numeric_dtypes=numeric_dtypes,
          integer_dtypes=integer_dtypes,
          unsigned_integer_dtypes=unsigned_integer_dtypes,
          floating_dtypes=floating_dtypes,
          valid_tuple_axes=valid_tuple_axes,
          broadcastable_shapes=broadcastable_shapes,
          mutually_broadcastable_shapes=mutually_broadcastable_shapes,
          indices=indices,
      )
  
      if api_version > "2021.12":
  
          @defines_strategy()
          def complex_dtypes(
              *, sizes: Union[CpxSize, Sequence[CpxSize]] = (64, 128)
          ) -> st.SearchStrategy[DataType]:
              return _complex_dtypes(xp, sizes=sizes)
  
          complex_dtypes.__doc__ = _complex_dtypes.__doc__
          kwargs["complex_dtypes"] = complex_dtypes
  
      namespace = StrategiesNamespace(**kwargs)
      try:
          _args_to_xps[(xp, api_version)] = namespace
      except TypeError:
          pass
  
      return namespace
  
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 22 for calling a global function with example usage: make_strategies_namespace(xp) and returns: namespace, namespace, _from_dtype, _arrays, _scalar_dtypes, _boolean_dtypes, _real_dtypes, _numeric_dtypes, _integer_dtypes, _unsigned_integer_dtypes, _floating_dtypes, str, f_args, str, _complex_dtypes, self