code: def kernel_method(f):
      """decorator for proxying MKM.method(kernel_id) to individual KMs by ID"""
  
      def wrapped(self, kernel_id, *args, **kwargs):
          # get the kernel
          km = self.get_kernel(kernel_id)
          method = getattr(km, f.__name__)
          # call the kernel's method
          r = method(*args, **kwargs)
          # last thing, call anything defined in the actual class method
          # such as logging messages
          f(self, kernel_id, *args, **kwargs)
          # return the method result
          return r
  
      return wrapped
  
imports: from __future__ import absolute_import
  import os
  import uuid
  import zmq
  from traitlets.config.configurable import LoggingConfigurable
  from ipython_genutils.importstring import import_item
  from traitlets import Any, Bool, Dict, DottedObjectName, Instance, Unicode, default, observe
  from ipython_genutils.py3compat import unicode_type
  from .kernelspec import NATIVE_KERNEL_NAME, KernelSpecManager
label_desc: Use image node_id 1 for calling a global function with example usage: kernel_method(f) and returns: wrapped, r