code: def apply_filter(
      fn: Callable[[Any], bool],
      input_feature: Optional[str] = None,
  ) -> ExampleTransformFn:
      """Filters examples for whom `fn` returns true on `input_feature`.
  
      Arguments:
        fn: the function that returns whether the input feature of an example should
          be filtered.
        input_feature: the input feature to apply `fn` to. If this is the empty
          string, then `fn` will receive the entire example.
  
      Returns:
        function that can be applied to filter examples.
      """
      if input_feature:
          input_parts = input_feature.split("/")
      else:
          input_parts = []
      return functools.partial(
          _apply_filter, fn=fn, in_parts=input_parts
      )
  
file_path: datasets/tensorflow_datasets/core/transform/transform_lib.py
imports: from __future__ import annotations
  import functools
  from typing import Any, Callable, Iterator, List, Mapping, Optional, Union
  import numpy
  from tensorflow_datasets.core import split_builder
label_desc: Use image node_id 7 for calling a global function with example usage: apply_filter(fn, input_feature) and returns: functools