code: def discrete_escape(trace: "Trace", msg: "Message") -> bool:
      """
      :param trace: a partial trace
      :param msg: the message at a Pyro primitive site
      :returns: boolean decision value
  
      Utility function that checks if a sample site is discrete and not already in a trace.
  
      Used by EscapeMessenger to decide whether to do a nonlocal exit at a site.
      Subroutine for integrating out discrete variables for variance reduction.
      """
      return (
          msg["type"] == "sample"
          and not msg["is_observed"]
          and msg["name"] is not None
          and msg["name"] not in trace
          and getattr(msg["fn"], "has_enumerate_support", False)
      )
  
file_path: pyro/pyro/poutine/util.py
imports: from typing import TYPE_CHECKING, List, Optional
  from pyro import settings
label_desc: Use image node_id 8 for calling a global function with example usage: discrete_escape(trace, msg) and returns: unknown