class_docstr: Context manager class that modifies behavior
  and adds side effects to stochastic functions
  i.e. callables containing Pyro primitive statements.
  
  This is the base Messenger class.
  It implements the default behavior for all Pyro primitives,
  so that the joint distribution induced by a stochastic function fn
  is identical to the joint distribution induced by ``Messenger()(fn)``.
  
  Class of transformers for messages passed during inference.
  Most inference operations are implemented in subclasses of this.
docstr: :param fn: function implementing operation
  :param str type: name of the operation
      (also passed to :func:`~pyro.poutine.runtime.effectful`)
  
  Dynamically remove operations from an effect.
  Useful for removing wrappers from libraries.
  
  Example::
  
      SomeMessengerClass.unregister(some_function, "name")
docstr_tok: [":","param","fn",":","function","implementing","operation",":","param","str","type",":","name","of","the","operation","(","also","passed","to",":","func",":","`","~pyro.poutine.runtime.effectful","`",")","Dynamically","remove","operations","from","an","effect",".","Useful","for","removing","wrappers","from","libraries",".","Example",":",":","SomeMessengerClass.unregister","(","some_function",",","``","name","''",")"]
code: def unregister(
      cls,
      fn: Optional[Callable] = None,
      type: Optional[str] = None,
  ) -> Optional[Callable]:
      """
      :param fn: function implementing operation
      :param str type: name of the operation
          (also passed to :func:`~pyro.poutine.runtime.effectful`)
  
      Dynamically remove operations from an effect.
      Useful for removing wrappers from libraries.
  
      Example::
  
          SomeMessengerClass.unregister(some_function, "name")
      """
      if type is None:
          raise ValueError("An operation type name must be provided")
  
      try:
          delattr(cls, "_pyro_post_" + type)
      except AttributeError:
          pass
  
      try:
          delattr(cls, "_pyro_" + type)
      except AttributeError:
          pass
  
      return fn
  
imports: from contextlib import contextmanager
  from functools import partial
  from types import TracebackType
  from typing import Any, Callable, Iterator, List, Optional, Type, TypeVar
  from typing_extensions import ParamSpec, Self
  from pyro.poutine.runtime import _PYRO_STACK, Message
label_desc: Use image node_id 8 for calling the Messenger obj's underlying member method code with example usage: obj.unregister(cls, fn, type) and returns: fn