code: def _patch_joblib():
      # noinspection PyBroadException
      try:
          if (
              not PatchedJoblib._patched_joblib
              and "joblib" in sys.modules
          ):
              PatchedJoblib._patched_joblib = True
              try:
                  import joblib
              except ImportError:
                  joblib = None
  
              if joblib:
                  joblib.numpy_pickle._write_fileobject = _patched_call(
                      joblib.numpy_pickle._write_fileobject,
                      partial(
                          PatchedJoblib._write_fileobject,
                          joblib.numpy_pickle,
                      ),
                  )
                  joblib.numpy_pickle._read_fileobject = _patched_call(
                      joblib.numpy_pickle._read_fileobject,
                      PatchedJoblib._load,
                  )
                  joblib.numpy_pickle.NumpyPickler.__init__ = (
                      _patched_call(
                          joblib.numpy_pickle.NumpyPickler.__init__,
                          PatchedJoblib._numpypickler,
                      )
                  )
                  joblib.memory.MemorizedFunc._cached_call = (
                      _patched_call(
                          joblib.memory.MemorizedFunc._cached_call,
                          PatchedJoblib._cached_call_recursion_guard,
                      )
                  )
  
          if (
              not PatchedJoblib._patched_sk_joblib
              and "sklearn" in sys.modules
          ):
              PatchedJoblib._patched_sk_joblib = True
              try:
                  import sklearn  # noqa: F401
  
                  # avoid deprecation warning, we must import sklearn before, so we could catch it
                  with warnings.catch_warnings():
                      warnings.simplefilter("ignore")
                      from sklearn.externals import joblib as sk_joblib
              except ImportError:
                  sk_joblib = None
  
              if sk_joblib:
                  sk_joblib.numpy_pickle._write_fileobject = (
                      _patched_call(
                          sk_joblib.numpy_pickle._write_fileobject,
                          partial(
                              PatchedJoblib._write_fileobject,
                              sk_joblib.numpy_pickle,
                          ),
                      )
                  )
                  sk_joblib.numpy_pickle._read_fileobject = (
                      _patched_call(
                          sk_joblib.numpy_pickle._read_fileobject,
                          PatchedJoblib._load,
                      )
                  )
                  sk_joblib.numpy_pickle.NumpyPickler.__init__ = (
                      _patched_call(
                          sk_joblib.numpy_pickle.NumpyPickler.__init__,
                          PatchedJoblib._numpypickler,
                      )
                  )
  
      except Exception:
          return False
      return True
  
imports: import sys
  import warnings
  from functools import partial
  import six
  from pathlib2 import Path
  from .import_bind import PostImportHookPatching
  from ..binding.frameworks import _patched_call, _Empty, WeightsFileHandler
  from ..config import running_remotely
  from ..debugging.log import LoggerRoot
  from ..model import Framework
  from ..utilities.lowlevel.file_access import get_filename_from_file_object, buffer_writer_close_cb
label_desc: Use image node_id 2 for calling the PatchedJoblib obj's underlying member method code with example usage: obj._patch_joblib() and returns: True, False