code: def get_model_file(
      dir_name,
      file_name_pattern,
      mode,
      model_load_type,
      specified_model_file_name,
  ):
      """
      Return model file according the specified model_load_type
      :param dir_name: the folder path where a file search will start
      :param file_name_pattern: the filename pattern that will be matched,
                                when searching model file with model_load_type=latest
      :param mode: which kind of command is performing [train, eval, infer]
      :param model_load_type: restore which kind of model [best, lastest, scratch, specific]
      :param specified_model_file_name: the model file which will be restored
                                        with model_load_type=specific
      """
      assert model_load_type in (
          None,
          "best",
          "latest",
          "scratch",
          "specific",
      )
  
      if model_load_type is None:
          logging.warning(
              "The values of model_load_type is not specified."
          )
          model_load_type = "latest" if mode == utils.TRAIN else "best"
          logging.warning(
              "For the {} command, model_load_type:{} is adopted.".format(
                  mode, model_load_type
              )
          )
  
      # model_load_type can not be 'scratch' when performing EVAL or INFER command
      if model_load_type == "scratch" and mode != utils.TRAIN:
          model_load_type = "best"
          logging.warning(
              "The model_load_type cannot be scratch when performing {} command, and is changed to {}".format(
                  mode, model_load_type
              )
          )
  
      # get the path of model file according the specificed model_load_type
      model_file_name = None
      if model_load_type == "specific":
          model_file_name = Path(dir_name).joinpath(
              specified_model_file_name
          )
          # the value of model_load_type will be changed to latest when specified_model_file_name is None
          if not model_file_name.exists():
              model_load_type = "latest"
              logging.warning(
                  "The specified model file {} is not exist, model_load_type:{} is adopted".format(
                      model_file_name, model_load_type
                  )
              )
  
      if model_load_type == "latest":
          model_file_name = (
              get_most_recently_modified_file_matching_pattern(
                  dir_name, file_name_pattern
              )
          )
      elif model_load_type == "best":
          model_file_name = Path(dir_name).joinpath("best_model.ckpt")
  
      # verify the existence of the file
      # model_file_name will be None when
      #     1.model_load_type=scratch
      #     2.no model_file is found with model_load_type=latest
      if model_file_name is None:
          logging.warning(
              "No model file is found in {} with model_load_type={}".format(
                  dir_name, model_load_type
              )
          )
          if mode == utils.TRAIN:
              model_load_type = "scratch"
              model_file_name = None
              logging.warning(
                  "The model will be trained with model_load_type:scratch"
              )
          else:
              assert (
                  False
              ), "{} END, since no model file is found".format(mode)
  
      return model_load_type, model_file_name
  
file_path: delta/delta/utils/solver/utils/solver_utils.py
imports: import os
  import re
  from pathlib import Path
  import numpy
  import delta.compat
  from absl import logging
  import shutil
  from delta import utils
  from delta.utils import metrics
label_desc: Use image node_id 6 for calling a global function with example usage: get_model_file(dir_name, file_name_pattern, mode, model_load_type, specified_model_file_name) and returns: model_load_type,  model_file_name