code: def get_final_steps_per_checkpoint(
      steps_per_epoch: int,
      steps_per_checkpoint: int = 0,
      checkpoints_per_epoch: float = 0,
      should_log: bool = False,
  ):
      """Returns the steps per checkpoint to use for the training loop, given user+default inputs."""
      if steps_per_checkpoint != 0 and checkpoints_per_epoch != 0:
          raise ValueError(
              "It is invalid to specify both checkpoints_per_epoch AND steps_per_checkpoint. Please specify one or the "
              "other, or specify neither to checkpoint/eval the model every epoch."
          )
  
      # Set steps_per_checkpoint based on the checkpoints_per_epoch, if checkpoints_per_epoch was specified.
      if checkpoints_per_epoch != 0:
          steps_per_checkpoint = int(
              steps_per_epoch / checkpoints_per_epoch
          )
  
      # Cap steps_per_checkpoint at steps_per_epoch.
      if steps_per_checkpoint > steps_per_epoch:
          if should_log:
              logger.info(
                  f"Note: steps_per_checkpoint (was {steps_per_checkpoint}) is now set to the number of "
                  f"steps per epoch: {steps_per_epoch}.\n"
              )
          return steps_per_epoch
  
      # steps_per_checkpoint wasn't specified. Use steps_per_epoch.
      if steps_per_checkpoint == 0:
          return steps_per_epoch
  
      return steps_per_checkpoint
  
imports: import logging
  from collections import defaultdict
  from typing import Dict, List, Tuple, TYPE_CHECKING
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import AUTO, COMBINED, LOSS
  from ludwig.models.base import BaseModel
  from ludwig.modules.metric_modules import get_best_function
  from ludwig.utils.data_utils import save_json
  from ludwig.utils.metric_utils import TrainerMetric
label_desc: Use image node_id 6 for calling a global function with example usage: get_final_steps_per_checkpoint(steps_per_epoch, steps_per_checkpoint, checkpoints_per_epoch, should_log) and returns: steps_per_checkpoint, steps_per_epoch, steps_per_epoch