code: def get_stage_info(stage_id, **kwargs):
      """Returns information for a training stage.
  
      Args:
        stage_id: An integer of training stage index.
        **kwargs: A dictionary of
            'num_resolutions': An integer of number of progressive resolutions.
            'stable_stage_num_images': An integer of number of training images in
                the stable stage.
            'transition_stage_num_images': An integer of number of training images
                in the transition stage.
            'total_num_images': An integer of total number of training images.
  
      Returns:
        A tuple of integers. The first entry is the number of blocks. The second
        entry is the accumulated total number of training images when stage
        `stage_id` is finished.
  
      Raises:
        ValueError: If `stage_id` is not in [0, total number of stages).
      """
      total_num_stages = get_total_num_stages(**kwargs)
      valid_stage_id = 0 <= stage_id < total_num_stages
      if not valid_stage_id:
          raise ValueError(
              "`stage_id` must be in [0, {0}), but instead was {1}".format(
                  total_num_stages, stage_id
              )
          )
  
      # Even stage_id: stable training stage.
      # Odd stage_id: transition training stage.
      num_blocks = (stage_id + 1) // 2 + 1
      num_images = (stage_id // 2 + 1) * kwargs[
          "stable_stage_num_images"
      ] + ((stage_id + 1) // 2) * kwargs["transition_stage_num_images"]
  
      total_num_images = kwargs["total_num_images"]
      if stage_id >= total_num_stages - 1:
          num_images = total_num_images
      num_images = min(num_images, total_num_images)
  
      return num_blocks, num_images
  
imports: import os
  import time
  from absl import logging
  from magenta.models.gansynth.lib import networks
  import numpy
  import tensorflow.compat.v1
  import tensorflow_gan
label_desc: Use image node_id 6 for calling a global function with example usage: get_stage_info(stage_id) and returns: num_blocks,  num_images