code: def tree_any_only(
      __type_or_types: TypeAny,
      pred: FnAny[bool],
      tree: PyTree,
      is_leaf: Optional[Callable[[PyTree], bool]] = None,
  ) -> bool:
      flat_args = tree_leaves(tree, is_leaf=is_leaf)
      return any(
          pred(x) for x in flat_args if isinstance(x, __type_or_types)
      )
  
imports: import functools
  import warnings
  from typing import Any, Callable, Iterable, List, Optional, overload, Tuple, Type, TypeVar, Union
  import torch
  import optree
  from optree import PyTreeSpec
label_desc: Use image node_id 33 for calling a global function with example usage: tree_any_only(__type_or_types, pred, tree, is_leaf) and returns: any