code: def get_most_recently_modified_file_matching_pattern(
      dir_name, file_name_pattern
  ):
      """Return the most recently checkpoint file matching file_name_pattern"""
      file_name_regex = (
          "^" + re.sub(r"{.*}", r".*", file_name_pattern) + "$"
      )
  
      tf_checkpoint_file = tf.train.latest_checkpoint(dir_name)
      if tf_checkpoint_file is not None and re.match(
          file_name_regex, tf_checkpoint_file
      ):
          return tf_checkpoint_file
  
      file_list = [
          file_name
          for file_name in Path(dir_name).iterdir()
          if re.match(file_name_regex, file_name.name)
      ]
      file_time_list = [
          single_file.stat().st_mtime for single_file in file_list
      ]
      file_sort_by_time = np.argsort(file_time_list)
      latest_file = (
          file_list[file_sort_by_time[-1]]
          if file_sort_by_time.shape[0] > 0
          else None
      )
      return latest_file
  
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 7 for calling a global function with example usage: get_most_recently_modified_file_matching_pattern(dir_name, file_name_pattern) and returns: latest_file, tf_checkpoint_file