code: def invoker(model, func, n_jobs=None, *, persist_method=None):
      """
      Get an appropriate invoker for performing oeprations on ``model``.
  
      Args:
          model(obj): The model object on which to perform operations.
          func(function): The function to call.  The function must be pickleable.
          n_jobs(int or None):
              The number of processes to use for parallel operations.  If ``None``, will
              call :func:`proc_count` with a maximum default process count of 4.
          persist_method(str or None):
              The persistence method to use.  Passed as ``method`` to
              :func:`lenskit.sharing.persist`.
  
      Returns:
          ModelOpInvoker:
              An invoker to perform operations on the model.
      """
      if n_jobs is None:
          n_jobs = proc_count(max_default=4)
  
      if n_jobs == 1:
          return InProcessOpInvoker(model, func)
      else:
          return ProcessPoolOpInvoker(
              model, func, n_jobs, persist_method
          )
  
imports: import os
  import multiprocessing
  from multiprocessing.queues import SimpleQueue
  import functools
  import logging
  import logging.handlers
  import faulthandler
  from concurrent.futures import ProcessPoolExecutor
  from abc import ABC, abstractmethod
  import pickle
  from threadpoolctl import threadpool_limits
  import seedbank
  from lenskit.sharing import persist, PersistedModel
  from lenskit.util.log import log_queue
label_desc: Use image node_id 11 for calling a global function with example usage: invoker(model, func, n_jobs) and returns: InProcessOpInvoker, ProcessPoolOpInvoker