code: def _make_default_hide_fn(
      hide_all: bool,
      expose_all: bool,
      hide: Optional[List[str]],
      expose: Optional[List[str]],
      hide_types: Optional[List[str]],
      expose_types: Optional[List[str]],
  ) -> Callable[["Message"], bool]:
      # first, some sanity checks:
      # hide_all and expose_all intersect?
      assert (hide_all is False and expose_all is False) or (
          hide_all != expose_all
      ), "cannot hide and expose a site"
  
      # hide and expose intersect?
      if hide is None:
          hide = []
      else:
          hide_all = False
  
      if expose is None:
          expose = []
      else:
          hide_all = True
  
      assert set(hide).isdisjoint(
          set(expose)
      ), "cannot hide and expose a site"
  
      # hide_types and expose_types intersect?
      if hide_types is None:
          hide_types = []
      else:
          hide_all = False
  
      if expose_types is None:
          expose_types = []
      else:
          hide_all = True
  
      assert set(hide_types).isdisjoint(
          set(expose_types)
      ), "cannot hide and expose a site type"
  
      return partial(
          _block_fn, expose, expose_types, hide, hide_types, hide_all
      )
  
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 2 for calling a global function with example usage: _make_default_hide_fn(hide_all, expose_all, hide, expose, hide_types, expose_types) and returns: partial