class_docstr: Messenger that does a nonlocal exit by raising a util.NonlocalExit exception
docstr: :param msg: current message at a trace site
  :returns: a sample from the stochastic function at the site.
  
  Evaluates self.escape_fn on the site (self.escape_fn(msg)).
  
  If this returns True, raises an exception NonlocalExit(msg).
  Else, implements default _pyro_sample behavior with no additional effects.
docstr_tok: [":","param","msg",":","current","message","at","a","trace","site",":","returns",":","a","sample","from","the","stochastic","function","at","the","site",".","Evaluates","self.escape_fn","on","the","site","(","self.escape_fn","(","msg",")",")",".","If","this","returns","True",",","raises","an","exception","NonlocalExit","(","msg",")",".","Else",",","implements","default","_pyro_sample","behavior","with","no","additional","effects","."]
code: def _pyro_sample(self, msg: Message) -> None:
      """
      :param msg: current message at a trace site
      :returns: a sample from the stochastic function at the site.
  
      Evaluates self.escape_fn on the site (self.escape_fn(msg)).
  
      If this returns True, raises an exception NonlocalExit(msg).
      Else, implements default _pyro_sample behavior with no additional effects.
      """
      if self.escape_fn(msg):
          msg["done"] = True
          msg["stop"] = True
  
          def cont(m: Message) -> None:
              raise NonlocalExit(m)
  
          msg["continuation"] = cont
  
imports: from typing import Callable
  from pyro.poutine.messenger import Messenger
  from pyro.poutine.runtime import Message, NonlocalExit
label_desc: Use image node_id 2 for calling the EscapeMessenger obj's underlying member method code with example usage: obj._pyro_sample(msg) without return types