code: def _make_filter_tree(is_leaf):
      def _filter_tree(mask: AxisSpec, arg: Any) -> PyTree[bool]:
          if isinstance(mask, bool):
              return jtu.tree_map(lambda _: mask, arg, is_leaf=is_leaf)
          elif callable(mask):
              return jtu.tree_map(mask, arg, is_leaf=is_leaf)
          else:
              raise ValueError(
                  "`filter_spec` must consist of booleans and callables only."
              )
  
      return _filter_tree
  
file_path: equinox/equinox/_filters.py
imports: from collections.abc import Callable
  from typing import Any, Optional, Union
  import jax
  import jax.numpy
  import jax.tree_util
  import numpy
  from jaxtyping import PyTree
label_desc: Use image node_id 5 for calling a global function with example usage: _make_filter_tree(is_leaf) and returns: _filter_tree, jtu, jtu