code: def apply_pending_transforms_in_order(
      transform,
      data,
      lazy: bool | None = None,
      overrides: dict | None = None,
      logger_name: bool | str = False,
  ):
      """
      This method causes "in order" processing of pending transforms to occur.
      "in order" processing of pending transforms ensures that all pending transforms have been applied to the
      tensor before a non-lazy transform (or lazy transform that is executing non-lazily) is carried out.
      It ensures that no operations will be added to a metatensor's apply_operations while there are outstanding
      pending_operations. Note that there is only one mechanism for executing lazy resampling at present but this
      is expected to change in future releases.
  
      Evaluation of pending transforms is performed under the following circumstances:
      * If the transform is a lazy transform and:
        * The transform checks data as part of its execution, or
        * the transform is not executing lazily
      * If the transform is an ApplyPending[d] transform
      * If the transform is not a lazy transform
  
      This method is designed to be used only in the context of implementing lazy resampling functionality. In general
      you should not need to interact with or use this method directly, and its API may change without warning between
      releases. See the :ref:`Lazy Resampling topic<lazy_resampling> for more information about lazy resampling.
  
      Args:
          transform: a transform that should be evaluated to determine whether pending transforms should be applied
          data: a tensor / MetaTensor, or dictionary containing tensors / MetaTensors whose pending transforms may
              need to be applied
          lazy: The lazy mode that is being applied (this can be False, True or None)
          overrides: An optional dictionary containing overrides to be applied to the pending transforms when they
              are lazily executed. If data is a dict, it should contain a dictionary of overrides for each key that
              needs them
          logger_name: An optional name for a logger to be used when applying pending transforms. If None,
              logging is suppressed.
      Returns:
          an object of the same type as data if pending transforms were applied, or 'data' if they were not
  
      """
      from monai.transforms.lazy.dictionary import ApplyPendingd
  
      must_apply_pending = True
      keys = (
          transform.keys
          if isinstance(transform, ApplyPendingd)
          else None
      )
      if (
          isinstance(transform, LazyTrait)
          and not transform.requires_current_data
      ):
          must_apply_pending = not (
              transform.lazy if lazy is None else lazy
          )
  
      if must_apply_pending is True:
          _log_pending_info(
              transform,
              data,
              "Apply pending transforms",
              lazy=lazy,
              logger_name=logger_name,
          )
          return apply_pending_transforms(
              data, keys, overrides, logger_name
          )
  
      _log_pending_info(
          transform,
          data,
          "Accumulate pending transforms",
          lazy=lazy,
          logger_name=logger_name,
      )
      return data
  
file_path: MONAI/monai/transforms/lazy/functional.py
imports: from __future__ import annotations
  from typing import Any, Mapping, Sequence
  import torch
  from monai.apps.utils import get_logger
  from monai.config import NdarrayOrTensor
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import to_affine_nd
  from monai.transforms.lazy.utils import affine_from_pending, combine_transforms, is_compatible_apply_kwargs, kwargs_from_pending, resample
  from monai.transforms.traits import LazyTrait
  from monai.transforms.transform import MapTransform
  from monai.utils import LazyAttr, look_up_option
label_desc: Use image node_id 4 for calling a global function with example usage: apply_pending_transforms_in_order(transform, data, lazy, overrides, logger_name) and returns: data, apply_pending_transforms