code: def _make_handler(msngr_cls, module=None):
      def handler_decorator(func):
          @functools.wraps(func)
          def handler(fn=None, *args, **kwargs):
              if fn is not None and not (
                  callable(fn)
                  or isinstance(fn, collections.abc.Iterable)
              ):
                  raise ValueError(
                      f"{fn} is not callable, did you mean to pass it as a keyword arg?"
                  )
              msngr = msngr_cls(*args, **kwargs)
              return (
                  functools.update_wrapper(msngr(fn), fn, updated=())
                  if fn is not None
                  else msngr
              )
  
          handler.__doc__ = """Convenient wrapper of :class:`~pyro.poutine.{}.{}` \n\n""".format(
              func.__name__ + "_messenger", msngr_cls.__name__
          ) + (
              msngr_cls.__doc__ if msngr_cls.__doc__ else ""
          )
          if module is not None:
              handler.__module__ = module
          return handler
  
      return handler_decorator
  
imports: import collections
  import functools
  from typing import Callable, Iterable, Optional, TypeVar, Union, overload
  from typing_extensions import ParamSpec
  from pyro.poutine import util
  from .block_messenger import BlockMessenger
  from .broadcast_messenger import BroadcastMessenger
  from .collapse_messenger import CollapseMessenger
  from .condition_messenger import ConditionMessenger
  from .do_messenger import DoMessenger
  from .enum_messenger import EnumMessenger
  from .escape_messenger import EscapeMessenger
  from .infer_config_messenger import InferConfigMessenger
  from .lift_messenger import LiftMessenger
  from .markov_messenger import MarkovMessenger
  from .mask_messenger import MaskMessenger
  from .reparam_messenger import ReparamMessenger
  from .replay_messenger import ReplayMessenger
  from .runtime import NonlocalExit
  from .scale_messenger import ScaleMessenger
  from .seed_messenger import SeedMessenger
  from .substitute_messenger import SubstituteMessenger
  from .trace_messenger import TraceMessenger
  from .uncondition_messenger import UnconditionMessenger
label_desc: Use image node_id 1 for calling a global function with example usage: _make_handler(msngr_cls, module) and returns: handler_decorator, handler, unknown