code: def match_file(dir_name: str, cache_dir: Path) -> str:
      r"""
      匹配的原则是: 在cache_dir下的文件与dir_name完全一致, 或除了后缀以外和dir_name完全一致。
      如果找到了两个匹配的结果将报错. 如果找到了则返回匹配的文件的名称; 没有找到返回空字符串
  
      :param dir_name: 需要匹配的名称
      :param cache_dir: 在该目录下找匹配dir_name是否存在
      :return str: 做为匹配结果的字符串
      """
      files = os.listdir(cache_dir)
      matched_filenames = []
      for file_name in files:
          if re.match(dir_name + "$", file_name) or re.match(
              dir_name + "\\..*", file_name
          ):
              matched_filenames.append(file_name)
      if len(matched_filenames) == 0:
          return ""
      elif len(matched_filenames) == 1:
          return matched_filenames[-1]
      else:
          raise RuntimeError(
              f"Duplicate matched files:{matched_filenames}, this should be caused by a bug."
          )
  
imports: import os
  import re
  import shutil
  import tempfile
  from pathlib import Path
  from urllib.parse import urlparse
  import requests
  from requests import HTTPError
  from fastNLP.core.log import logger
  from rich.progress import Progress, BarColumn, DownloadColumn, TimeRemainingColumn, TimeElapsedColumn
label_desc: Use image node_id 13 for calling a global function with example usage: match_file(dir_name, cache_dir) and returns: str, matched_filenames