code: def _copy_allowed_file(filepath: Path, dst_directory: Path):
      """
      Copies files from allowlist to a directory, overriding existing
      files or directories if any.
      """
      if filepath.name not in _ALLOWLIST_PATHS:
          return
  
      dst = dst_directory / filepath.name
      if dst.is_dir():
          shutil.rmtree(str(dst))
      elif dst.is_file():
          dst.unlink()
      if filepath.is_dir():
          shutil.copytree(filepath, dst)
      elif filepath.is_file():
          if filepath.name in ["best.th", "weights.th"]:
              dst = dst_directory / "weights.th"
          shutil.copy(str(filepath), str(dst))
  
file_path: allennlp/allennlp/common/push_to_hf.py
imports: import logging
  import shutil
  import tarfile
  import tempfile
  import zipfile
  from os import PathLike
  from pathlib import Path
  from typing import Optional, Union
  from huggingface_hub import HfApi, HfFolder, Repository
  from allennlp.common.file_utils import cached_path
label_desc: Use image node_id 2 for calling a global function with example usage: _copy_allowed_file(filepath, dst_directory) without return types