code: def get_model_for_finetuning(
      previous_model_file_or_dir: Union[Path, Text]
  ) -> Optional[Path]:
      """Gets validated path for model to finetune.
  
      Args:
          previous_model_file: Path to model file which should be used for finetuning or
              a directory in case the latest trained model should be used.
  
      Returns:
          Path to model archive. `None` if there is no model.
      """
      model_file: Optional[
          Union[Path, Text]
      ] = previous_model_file_or_dir
      if Path(previous_model_file_or_dir).is_dir():
          logger.debug(
              f"Trying to load latest model from '{previous_model_file_or_dir}' for "
              f"finetuning."
          )
          model_file = get_latest_model(previous_model_file_or_dir)
  
      if model_file and Path(model_file).is_file():
          return Path(model_file)
  
      logger.debug(
          "No valid model for finetuning found as directory either "
          "contains no model or model file cannot be found."
      )
      return None
  
file_path: rasa/rasa/model.py
imports: import glob
  import hashlib
  import logging
  import os
  from pathlib import Path
  from subprocess import check_output, DEVNULL, CalledProcessError
  from typing import Text, Optional, Union
  from rasa.shared.constants import DEFAULT_MODELS_PATH
  from rasa.exceptions import ModelNotFound
label_desc: Use image node_id 3 for calling a global function with example usage: get_model_for_finetuning(previous_model_file_or_dir) and returns: None, Path