code: def migrate_file(src, dst, substitutions=None):
      """Migrate a single file from src to dst
  
      substitutions is an optional dict of {regex: replacement} for performing replacements on the file.
      """
      log = get_logger()
      if os.path.exists(dst):
          # already exists
          log.debug("%s already exists" % dst)
          return False
      log.info("Copying %s -> %s" % (src, dst))
      ensure_dir_exists(os.path.dirname(dst))
      shutil.copy(src, dst)
      if substitutions:
          with open(dst) as f:
              text = f.read()
          for pat, replacement in substitutions.items():
              text = pat.sub(replacement, text)
          with open(dst, "w") as f:
              f.write(text)
      return True
  
file_path: catboost/contrib/python/jupyter-core/py2/jupyter_core/migrate.py
imports: from __future__ import unicode_literals
  import os
  import re
  import shutil
  from datetime import datetime
  from traitlets.config import PyFileConfigLoader, JSONFileConfigLoader
  from traitlets.log import get_logger
  from .utils import ensure_dir_exists
  from .paths import jupyter_config_dir, jupyter_data_dir
  from .application import JupyterApp
label_desc: Use image node_id 3 for calling a global function with example usage: migrate_file(src, dst, substitutions) and returns: True, False