code: def _determine_batch_limits(
      batches: Optional[Union[int, float]], name: str
  ) -> Union[int, float]:
      if batches is None:
          # batches is optional to know if the user passed a value so that we can show the above info messages only to the
          # users that set a value explicitly
          return 1.0
  
      # differentiating based on the type can be error-prone for users. show a message describing the chosen behaviour
      if isinstance(batches, int) and batches == 1:
          if name == "limit_train_batches":
              message = "1 batch per epoch will be used."
          elif name == "val_check_interval":
              message = "validation will run after every batch."
          else:
              message = "1 batch will be used."
          rank_zero_info(
              f"`Trainer({name}=1)` was configured so {message}"
          )
      elif isinstance(batches, float) and batches == 1.0:
          if name == "limit_train_batches":
              message = "100% of the batches per epoch will be used."
          elif name == "val_check_interval":
              message = "validation will run at the end of the training epoch."
          else:
              message = "100% of the batches will be used."
          rank_zero_info(
              f"`Trainer({name}=1.0)` was configured so {message}."
          )
  
      if 0 <= batches <= 1:
          return batches
      if batches > 1 and batches % 1.0 == 0:
          return int(batches)
      raise MisconfigurationException(
          f"You have passed invalid value {batches} for {name}, it has to be in [0.0, 1.0] or an int."
      )
  
file_path: pytorch-lightning/src/lightning/pytorch/trainer/setup.py
imports: from typing import Optional, Union
  import lightning.pytorch
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch.accelerators import CUDAAccelerator, MPSAccelerator, XLAAccelerator
  from lightning.pytorch.loggers.logger import DummyLogger
  from lightning.pytorch.profilers import AdvancedProfiler, PassThroughProfiler, Profiler, PyTorchProfiler, SimpleProfiler, XLAProfiler
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.imports import _graphcore_available_and_importable, _habana_available_and_importable
  from lightning.pytorch.utilities.rank_zero import rank_zero_info, rank_zero_warn
label_desc: Use image node_id 2 for calling a global function with example usage: _determine_batch_limits(batches, name) and returns: int, batches, int