def process_leaf_or_filtered(leaf_or_subtree):
          """Processes leaves or values where filter_fn is True."""
          if safe_filter_fn(leaf_or_subtree):
            return _InProgressSelectionBoundary(leaf_or_subtree)
          else:
            return leaf_or_subtree
Processes leaves or values where filter_fn is True.
penzai/core/selectors.py