code: def _make_single_func_robust(
      func: Union[Callable, FuncWrapper],
      min_nb_samples: int,
      error_val: Any,
      passthrough_nans: bool,
  ) -> FuncWrapper:
      """Decorate a single`func` into a robust FuncWrapper.
  
      Parameters
      ----------
      func: Union[Callable, FuncWrapper]
          The function that should be made robust.
      min_nb_samples: int
          The minimum number of samples that are needed for `func` to be applied
          successfully.
      error_val: Any
          The error *return* value if the `min_nb_samples` requirement is not met.
      passthrough_nans: bool
          If set to true, `np.NaN` values, which occur in the data will be passed through.
          Otherwise, the `np.NaN` values will be masked out before being passed to `func`.
  
      Returns
      -------
      FuncWrapper
          The robust FuncWrapper.
  
      """
      assert isinstance(func, FuncWrapper) or isinstance(func, Callable)
  
      func_wrapper_kwargs = {}
      if isinstance(func, FuncWrapper):
          # Extract the function and keyword arguments from the function wrapper
          func, func_wrapper_kwargs = _get_funcwrapper_func_and_kwargs(
              func
          )
  
      output_names = func_wrapper_kwargs.get("output_names")
  
      def wrap_func(
          *series: Union[np.ndarray, pd.Series], **kwargs
      ) -> Callable:
          if not passthrough_nans:
              series = [s[~np.isnan(s)] for s in series]
          if any([len(s) < min_nb_samples for s in series]):
              if (
                  not isinstance(output_names, list)
                  or len(output_names) == 1
              ):
                  return error_val
              return tuple([error_val] * len(output_names))
          return func(*series, **kwargs)
  
      wrap_func.__name__ = "[robust]__" + _get_name(func)
      if "output_names" not in func_wrapper_kwargs.keys():
          func_wrapper_kwargs["output_names"] = _get_name(func)
  
      return FuncWrapper(wrap_func, **func_wrapper_kwargs)
  
file_path: tsflex/tsflex/features/utils.py
imports: from typing import Any, Callable, List, Optional, Tuple, Union
  import numpy
  import pandas
  from .function_wrapper import FuncWrapper, _get_name
label_desc: Use image node_id 4 for calling a global function with example usage: _make_single_func_robust(func, min_nb_samples, error_val, passthrough_nans) and returns: FuncWrapper, func, tuple, error_val