code: def _ipython_dir_changed(self, change):
      old = change["old"]
      new = change["new"]
      if old is not Undefined:
          str_old = os.path.abspath(old)
          if str_old in sys.path:
              sys.path.remove(str_old)
      if self.add_ipython_dir_to_sys_path:
          str_path = os.path.abspath(new)
          sys.path.append(str_path)
          ensure_dir_exists(new)
          readme = os.path.join(new, "README")
          readme_src = os.path.join(
              get_ipython_package_dir(), "config", "profile", "README"
          )
          if not os.path.exists(readme) and os.path.exists(readme_src):
              shutil.copy(readme_src, readme)
          for d in ("extensions", "nbextensions"):
              path = os.path.join(new, d)
              try:
                  ensure_dir_exists(path)
              except OSError as e:
                  # this will not be EEXIST
                  self.log.error("couldn't create path %s: %s", path, e)
          self.log.debug("IPYTHONDIR set to: %s", new)
  
imports: import atexit
  from copy import deepcopy
  import logging
  import os
  import shutil
  import sys
  from pathlib import Path
  from traitlets.config.application import Application, catch_config_error
  from traitlets.config.loader import ConfigFileNotFound, PyFileConfigLoader
  from IPython.core import release, crashhandler
  from IPython.core.profiledir import ProfileDir, ProfileDirError
  from IPython.paths import get_ipython_dir, get_ipython_package_dir
  from IPython.utils.path import ensure_dir_exists
  from traitlets import List, Unicode, Type, Bool, Set, Instance, Undefined, default, observe
label_desc: Use image node_id 12 for calling the BaseIPythonApplication obj's underlying member method code with example usage: obj._ipython_dir_changed(change) without return types