code: def _block_fn(
      expose: List[str],
      expose_types: List[str],
      hide: List[str],
      hide_types: List[str],
      hide_all: bool,
      msg: "Message",
  ) -> bool:
      # handle observes
      if msg["type"] == "sample" and msg["is_observed"]:
          msg_type = "observe"
      else:
          msg_type = msg["type"]
  
      is_not_exposed = (msg["name"] not in expose) and (
          msg_type not in expose_types
      )
  
      # decision rule for hiding:
      if (
          (msg["name"] in hide)
          or (msg_type in hide_types)
          or (is_not_exposed and hide_all)
      ):  # noqa: E129
          return True
      # otherwise expose
      else:
          return False
  
file_path: pyro/pyro/poutine/block_messenger.py
imports: from functools import partial
  from typing import TYPE_CHECKING, Callable, List, Optional
  from pyro.poutine.messenger import Messenger
label_desc: Use image node_id 1 for calling a global function with example usage: _block_fn(expose, expose_types, hide, hide_types, hide_all, msg) and returns: True, False