code: def get_cond_latents(all_latents=None, hparams=None):
      """Get z^{cond}_{t} given z^{1..t-1}.
  
      Args:
        all_latents: list of list of tensors,
                     outer-size equals no.of time_steps-1
                     inner-size equals hparams.n_levels.
        hparams: See next_frame_glow_hparams.
      Returns:
        cond_latents: conditional latents at time-step t.
      """
      cond_latents = None
      if hparams.gen_mode == "conditional":
          if hparams.latent_dist_encoder in ["conv_net", "conv3d_net"]:
              num_cond_latents = hparams.num_cond_latents + int(
                  hparams.cond_first_frame
              )
              if len(all_latents) >= num_cond_latents:
                  cond_latents = all_latents[
                      -hparams.num_cond_latents :
                  ]
                  if hparams.cond_first_frame:
                      cond_latents = [all_latents[0]] + cond_latents
          elif hparams.latent_dist_encoder in [
              "pointwise",
              "conv_lstm",
          ]:
              if all_latents:
                  cond_latents = all_latents[-1]
  
      if hparams.gen_mode == "conditional":
          global_step = tf.train.get_or_create_global_step()
          condition = tf.greater(global_step, hparams.pretrain_steps)
      else:
          condition = tf.constant(False, dtype=tf.bool)
      return condition, cond_latents
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from six.moves import range
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import common_video
  from tensor2tensor.layers import modalities
  from tensor2tensor.models.research import glow
  from tensor2tensor.models.research import glow_ops
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
  import tensorflow_probability
label_desc: Use image node_id 6 for calling a global function with example usage: get_cond_latents(all_latents, hparams) and returns: condition,  cond_latents