docstr: Returns the latest checkpoint from the ``checkpoint_dir``
  
  Args:
      checkpoint_dir: the directory to search for checkpoints
docstr_tok: ["Returns","the","latest","checkpoint","from","the","``","checkpoint_dir","``","Args",":","checkpoint_dir",":","the","directory","to","search","for","checkpoints"]
code: def get_latest_checkpoint(checkpoint_dir: str) -> Optional[str]:
      """Returns the latest checkpoint from the ``checkpoint_dir``
  
      Args:
          checkpoint_dir: the directory to search for checkpoints
  
      """
      if not os.path.isdir(checkpoint_dir):
          return None
  
      items = sorted(os.listdir(checkpoint_dir))
  
      if not items:
          return None
  
      return os.path.join(checkpoint_dir, items[-1])
  
imports: import os
  from collections.abc import Mapping
  from functools import partial
  from typing import Any, Iterable, List, Literal, Optional, Tuple, Union, cast
  import lightning
  import torch
  from lightning.fabric.accelerators import Accelerator
  from lightning.fabric.loggers import Logger
  from lightning.fabric.strategies import Strategy
  from lightning.fabric.wrappers import _unwrap_objects
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning_utilities import apply_to_collection
  from tqdm import tqdm
label_desc: Use image node_id 11 for calling the MyCustomTrainer obj's underlying member method code with example usage: obj.get_latest_checkpoint(checkpoint_dir) and returns: os, None, None