code: def is_sample_site(msg, *, include_deterministic=False):
      if msg["type"] != "sample":
          return False
      if site_is_subsample(msg):
          return False
  
      if not include_deterministic:
          # Ignore masked observations.
          if msg["is_observed"] and msg["mask"] is False:
              return False
  
          # Exclude deterministic sites.
          fn = msg["fn"]
          while hasattr(fn, "base_dist"):
              fn = fn.base_dist
          if type(fn).__name__ == "Delta":
              return False
  
      return True
  
imports: import itertools
  import os
  from collections import defaultdict
  from pathlib import Path
  from types import SimpleNamespace
  from typing import Callable, Collection, Dict, List, Optional, Union
  import torch
  import pyro
  import pyro.distributions
  import pyro.poutine
  from pyro.ops.provenance import ProvenanceTensor, detach_provenance, get_provenance
  from pyro.poutine.messenger import Messenger
  from pyro.poutine.util import site_is_subsample
label_desc: Use image node_id 1 for calling a global function with example usage: is_sample_site(msg) and returns: True, False, False, False, False