code: def predefine_event(func):
      forbidden_param_kinds = (
          inspect.Parameter.POSITIONAL_ONLY,
          inspect.Parameter.VAR_POSITIONAL,
      )
      signature = inspect.signature(func)
      for param in signature.parameters.values():
          assert param.kind not in forbidden_param_kinds
  
      def handle_event(self, **kwargs):
          # TODO allow calls w/ positional arguments?
          self.trigger(func.__name__, **kwargs)
  
      return handle_event
  
imports: import inspect
  from typing import Callable, Set
label_desc: Use image node_id 5 for calling a global function with example usage: predefine_event(func) and returns: handle_event