code: def get_stat_func(stat):
      def func(ds):
          if hasattr(ds, stat):
              return getattr(ds, stat)()
          else:
              # implement stat
              raise ValueError(f"{stat} function is not implemented.")
  
      return func
  
imports: import warnings
  from cuml.common.exceptions import NotFittedError
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: get_stat_func(stat) and returns: func, getattr