code: def test_is_leaf():
      class M(eqx.Module):
          value: Any
  
      def is_m(x):
          return isinstance(x, M)
  
      def filter_spec(x):
          if is_m(x):
              return x.value == 1
          return True
  
      pytree = [M(1), M(2), 3]
      out = eqx.filter(pytree, filter_spec, is_leaf=is_m)
      assert out == [M(1), None, 3]
      out1, out2 = eqx.partition(pytree, filter_spec, is_leaf=is_m)
      assert out1 == [M(1), None, 3]
      assert out2 == [None, M(2), None]
  
file_path: equinox/tests/test_filters.py
imports: from typing import Any
  import equinox
  import jax.numpy
  import jax.tree_util
  import numpy
  import pytest
label_desc: Use image node_id 8 for calling a global function with example usage: test_is_leaf() and returns: isinstance, True, unknown