code: def _check_mean_function(metric):
      """Check mean function."""
      if isinstance(metric, str):
          if metric not in mean_functions.keys():
              raise ValueError(f"Unknown mean metric '{metric}'")
          else:
              metric = mean_functions[metric]
      elif not hasattr(metric, "__call__"):
          raise ValueError(
              "Mean metric must be a function or a string "
              f"(Got {type(metric)}."
          )
      return metric
  
imports: from copy import deepcopy
  import numpy
  import warnings
  from .ajd import ajd_pham
  from .base import sqrtm, invsqrtm, logm, expm, powm
  from .distance import distance_riemann
  from .geodesic import geodesic_riemann
  from .utils import check_weights
label_desc: Use image node_id 13 for calling a global function with example usage: _check_mean_function(metric) and returns: metric