class_docstr: Provide a custom function to check if trial should be stopped.
  
  The passed function will be called after each iteration. If it returns
  True, the trial will be stopped.
  
  Args:
      function: Function that checks if a trial
          should be stopped. Must accept the `trial_id` string  and `result`
          dictionary as arguments. Must return a boolean.
code: def is_valid_function(cls, fn):
      is_function = callable(fn) and not issubclass(type(fn), Stopper)
      if is_function and hasattr(fn, "stop_all"):
          raise ValueError(
              "Stop object must be ray.tune.Stopper subclass to be detected "
              "correctly."
          )
      return is_function
  
file_path: ray/python/ray/tune/stopper/function_stopper.py
imports: from typing import Dict, Callable
  from ray.util.annotations import PublicAPI
  from ray.tune.stopper.stopper import Stopper
label_desc: Use image node_id 4 for calling the FunctionStopper obj's underlying member method code with example usage: obj.is_valid_function(cls, fn) and returns: is_function