code: def _check_app_state_collision(
      app_state: Dict[str, _TStateful]
  ) -> None:
      keys_to_check = (
          _TRAIN_DL_STATE_KEY,
          _RNG_STATE_KEY,
      )
      for key in keys_to_check:
          if key in app_state:
              raise RuntimeError(
                  f"Detected collision for key in app state: {key}. TorchSnapshotSaver expects to save and load this key."
              )
  
imports: from __future__ import annotations
  import logging
  from contextlib import contextmanager, ExitStack
  from typing import Any, Dict, Generator, Iterable, List, Optional, Set, Union
  import torch.distributed
  from torchtnt.framework.callbacks._checkpoint_utils import _prepare_app_state, _prepare_app_state_for_checkpoint, _prepare_app_state_for_restore, _TRAIN_DL_STATE_KEY
  from torchtnt.framework.callbacks.base_checkpointer import BaseCheckpointer
  from torchtnt.framework.callbacks.checkpointer_types import KnobOptions, RestoreOptions
  from torchtnt.framework.state import State
  from torchtnt.framework.unit import AppStateMixin, TEvalUnit, TPredictUnit, TTrainData, TTrainUnit
  from torchtnt.framework.utils import get_timing_context
  from torchtnt.utils.optimizer import init_optim_state
  from torchtnt.utils.rank_zero_log import rank_zero_info, rank_zero_warn
  from torchtnt.utils.stateful import Stateful
label_desc: Use image node_id 2 for calling a global function with example usage: _check_app_state_collision(app_state) without return types