code: def _check_combine(mode, valid=("mean", "median", "std"), axis=0):
      if mode == "mean":
  
          def fun(data):
              return np.mean(data, axis=axis)
  
      elif mode == "std":
  
          def fun(data):
              return np.std(data, axis=axis)
  
      elif mode == "median" or mode == np.median:
  
          def fun(data):
              return _median_complex(data, axis=axis)
  
      elif callable(mode):
          fun = mode
      else:
          raise ValueError(
              "Combine option must be "
              + ", ".join(valid)
              + " or callable, got %s (type %s)." % (mode, type(mode))
          )
      return fun
  
imports: import numbers
  import operator
  import os
  import re
  from builtins import input
  from difflib import get_close_matches
  from importlib import import_module
  from pathlib import Path
  import numpy
  from ..defaults import HEAD_SIZE_DEFAULT, _handle_default
  from ..fixes import _compare_version, _median_complex
  from ._logging import _record_warnings, _verbose_safe_false, logger, verbose, warn
label_desc: Use image node_id 39 for calling a global function with example usage: _check_combine(mode, valid, axis) and returns: fun, np, np, _median_complex