code: def _copy_and_replace_placeholder_dir(
      src: str,
      dst: str,
      ignore_paths: Set[str],
      replace_dict: Dict[Pattern[str], str],
  ) -> None:
      """Copy a directory to destination path and replace the placeholders."""
      if not os.path.isdir(dst):
          if os.path.exists(dst):
              raise RuntimeError(
                  "Cannot copy template directory {}. Already a file exists.".format(
                      src
                  )
              )
          fileio.makedirs(dst)
      for f in os.listdir(src):
          src_path = os.path.join(src, f)
          dst_path = os.path.join(dst, f)
          if src_path in ignore_paths:
              continue
  
          if os.path.isdir(src_path):
              if f.startswith(
                  "_"
              ):  # Excludes __pycache__ and other private folders.
                  continue
              _copy_and_replace_placeholder_dir(
                  src_path, dst_path, ignore_paths, replace_dict
              )
          else:  # a file.
              if f.endswith(".pyc"):  # Excludes .pyc
                  continue
              _copy_and_replace_placeholder_file(
                  src_path, dst_path, replace_dict
              )
  
file_path: tfx/tfx/tools/cli/handler/template_handler.py
imports: import collections
  import os
  import re
  from typing import Dict, Any, List, Pattern, Set
  import urllib.request
  import click
  from tfx.dsl.io import fileio
  from tfx.tools.cli import labels
label_desc: Use image node_id 4 for calling a global function with example usage: _copy_and_replace_placeholder_dir(src, dst, ignore_paths, replace_dict) without return types