code: def _ipython_dir_changed(self, change):
      old = change["old"]
      new = change["new"]
      if old is not Undefined:
          str_old = py3compat.cast_bytes_py2(
              os.path.abspath(old), sys.getfilesystemencoding()
          )
          if str_old in sys.path:
              sys.path.remove(str_old)
      str_path = py3compat.cast_bytes_py2(
          os.path.abspath(new), sys.getfilesystemencoding()
      )
      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 glob
  import logging
  import os
  import shutil
  import sys
  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 IPython.utils import py3compat
  from traitlets import List, Unicode, Type, Bool, Dict, Set, Instance, Undefined, default, observe
label_desc: Use image node_id 13 for calling the BaseIPythonApplication obj's underlying member method code with example usage: obj._ipython_dir_changed(change) without return types