code: def _install_extension_nb41(enable=True):
      """deprecated, pre-4.2 implementation of installing notebook extension"""
      # server-side
      server = BaseJSONConfigManager(config_dir=jupyter_config_dir())
      server_cfg = server.get("jupyter_notebook_config")
      app_cfg = server_cfg.get("NotebookApp", {})
      server_extensions = app_cfg.get("server_extensions", [])
      server_ext = "ipyparallel.nbextension"
      server_changed = False
      if enable and server_ext not in server_extensions:
          server_extensions.append(server_ext)
          server_changed = True
      elif (not enable) and server_ext in server_extensions:
          server_extensions.remove(server_ext)
          server_changed = True
      if server_changed:
          server.update(
              "jupyter_notebook_config",
              {
                  "NotebookApp": {
                      "server_extensions": server_extensions,
                  }
              },
          )
  
      # frontend config (*way* easier because it's a dict)
      frontend = FrontendConfigManager()
      frontend.update(
          "tree",
          {
              "load_extensions": {
                  "ipyparallel/main": enable or None,
              }
          },
      )
  
imports: from jupyter_core.paths import jupyter_config_dir
  from notebook.services.config import ConfigManager
  from traitlets.config.manager import BaseJSONConfigManager
label_desc: Use image node_id 2 for calling a global function with example usage: _install_extension_nb41(enable) without return types