code: def broadcastable_shapes(
      shape: Shape,
      *,
      min_dims: int = 0,
      max_dims: Optional[int] = None,
      min_side: int = 1,
      max_side: Optional[int] = None,
  ) -> st.SearchStrategy[Shape]:
      """Return a strategy for shapes that are broadcast-compatible with the
      provided shape.
  
      Examples from this strategy shrink towards a shape with length ``min_dims``.
      The size of an aligned dimension shrinks towards size ``1``. The size of an
      unaligned dimension shrink towards ``min_side``.
  
      * ``shape`` is a tuple of integers.
      * ``min_dims`` is the smallest length that the generated shape can possess.
      * ``max_dims`` is the largest length that the generated shape can possess,
        defaulting to ``max(len(shape), min_dims) + 2``.
      * ``min_side`` is the smallest size that an unaligned dimension can possess.
      * ``max_side`` is the largest size that an unaligned dimension can possess,
        defaulting to 2 plus the size of the largest aligned dimension.
  
      The following are some examples drawn from this strategy.
  
      .. code-block:: pycon
  
          >>> [broadcastable_shapes(shape=(2, 3)).example() for i in range(5)]
          [(1, 3), (), (2, 3), (2, 1), (4, 1, 3), (3, )]
  
      """
      check_type(tuple, shape, "shape")
      check_type(int, min_side, "min_side")
      check_type(int, min_dims, "min_dims")
      check_valid_dims(min_dims, "min_dims")
  
      strict_check = max_side is None or max_dims is None
  
      if max_dims is None:
          max_dims = min(max(len(shape), min_dims) + 2, NDIM_MAX)
      check_type(int, max_dims, "max_dims")
      check_valid_dims(max_dims, "max_dims")
  
      if max_side is None:
          max_side = max(shape[-max_dims:] + (min_side,)) + 2
      check_type(int, max_side, "max_side")
  
      order_check("dims", 0, min_dims, max_dims)
      order_check("side", 0, min_side, max_side)
  
      if strict_check:
          dims = max_dims
          bound_name = "max_dims"
      else:
          dims = min_dims
          bound_name = "min_dims"
  
      # check for unsatisfiable min_side
      if not all(min_side <= s for s in shape[::-1][:dims] if s != 1):
          raise InvalidArgument(
              f"Given shape={shape}, there are no broadcast-compatible "
              f"shapes that satisfy: {bound_name}={dims} and min_side={min_side}"
          )
  
      # check for unsatisfiable [min_side, max_side]
      if not (
          min_side <= 1 <= max_side
          or all(s <= max_side for s in shape[::-1][:dims])
      ):
          raise InvalidArgument(
              f"Given base_shape={shape}, there are no broadcast-compatible "
              f"shapes that satisfy all of {bound_name}={dims}, "
              f"min_side={min_side}, and max_side={max_side}"
          )
  
      if not strict_check:
          # reduce max_dims to exclude unsatisfiable dimensions
          for n, s in zip(range(max_dims), shape[::-1]):
              if s < min_side and s != 1:
                  max_dims = n
                  break
              elif not (min_side <= 1 <= max_side or s <= max_side):
                  max_dims = n
                  break
  
      return MutuallyBroadcastableShapesStrategy(
          num_shapes=1,
          base_shape=shape,
          min_dims=min_dims,
          max_dims=max_dims,
          min_side=min_side,
          max_side=max_side,
      ).map(lambda x: x.input_shapes[0])
  
imports: import re
  from typing import NamedTuple, Optional, Tuple, Union
  from hypothesis import assume, strategies
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.conjecture.utils import _calc_p_continue
  from hypothesis.internal.coverage import check_function
  from hypothesis.internal.validation import check_type, check_valid_interval
  from hypothesis.strategies._internal.utils import defines_strategy
  from hypothesis.utils.conventions import UniqueIdentifier, not_set
label_desc: Use image node_id 6 for calling a global function with example usage: broadcastable_shapes(shape) and returns: MutuallyBroadcastableShapesStrategy