code: def _make_kernel_stack(kernel):
      kernel_stack = [kernel]
      while "target_log_prob_fn" not in kernel.parameters:
          if "inner_kernel" not in kernel.parameters:
              raise ValueError(
                  '"None of the nested `inner_kernel`s contains a '
                  '`target_log_prob_fn`."'
              )
          kernel = kernel.inner_kernel
          kernel_stack.append(kernel)
      return kernel_stack
  
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.mcmc import kernel
  from tensorflow_probability.python.mcmc.internal import util
  from tensorflow.python.util import deprecation
label_desc: Use image node_id 4 for calling a global function with example usage: _make_kernel_stack(kernel) and returns: kernel_stack