code: def _compute_rank_and_fullsize_reqd(
      draw, target_shape, current_shape, is_last
  ):
      """Returns a param rank and a list of bools for full-size-required by axis.
  
      Args:
        draw: Hypothesis data sampler.
        target_shape: `tf.TensorShape`, the target broadcasted shape.
        current_shape: `tf.TensorShape`, the broadcasted shape of the shapes
          selected thus far. This is ignored for non-last shapes.
        is_last: bool indicator of whether this is the last shape (in which case, we
          must achieve the target shape).
  
      Returns:
        next_rank: Sampled rank for the next shape.
        force_fullsize_dim: `next_rank`-sized list of bool indicating whether the
          corresponding axis of the shape must be full-sized (True) or is allowed to
          be 1 (i.e., broadcast) (False).
      """
      target_rank = tensorshape_util.rank(target_shape)
      if is_last:
          # We must force full size dim on any mismatched axes, and proper rank.
          full_rank_current = tf.broadcast_static_shape(
              current_shape, tf.TensorShape([1] * target_rank)
          )
          # Identify axes in which the target shape is not yet matched.
          full_rank_current_list = tensorshape_util.as_list(
              full_rank_current
          )
          target_shape_list = tensorshape_util.as_list(target_shape)
          axis_is_mismatched = [
              full_rank_current_list[i] != target_shape_list[i]
              for i in range(target_rank)
          ]
          min_rank = target_rank
          if tensorshape_util.rank(current_shape) == target_rank:
              # Current rank might be already correct, but we could have a case like
              # batch_shape=[4,3,2] and current_batch_shape=[4,1,2], in which case
              # we must have at least 2 axes on this param's batch shape.
              min_rank -= (axis_is_mismatched + [True]).index(True)
          next_rank = draw(
              hps.integers(min_value=min_rank, max_value=target_rank)
          )
          # Get the last param_batch_rank (possibly 0!) items.
          force_fullsize_dim = axis_is_mismatched[
              target_rank - next_rank :
          ]
      else:
          # There are remaining params to be drawn, so we will be able to force full
          # size axes on subsequent params.
          next_rank = draw(
              hps.integers(min_value=0, max_value=target_rank)
          )
          force_fullsize_dim = [False] * next_rank
      return next_rank, force_fullsize_dim
  
imports: import contextlib
  import os
  import re
  import traceback
  import unittest
  import hypothesis
  from hypothesis.extra import numpy
  import hypothesis.strategies
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.util.deferred_tensor import DeferredTensor
label_desc: Use image node_id 25 for calling a global function with example usage: _compute_rank_and_fullsize_reqd(draw, target_shape, current_shape, is_last) and returns: next_rank,  force_fullsize_dim