code: def get_corr_func(
      method: CorrelationMethod,
  ) -> Callable[[np.ndarray, np.ndarray], float]:
      if method == "kendall":
          from scipy.stats import kendalltau
  
          def func(a, b):
              return kendalltau(a, b)[0]
  
          return func
      elif method == "spearman":
          from scipy.stats import spearmanr
  
          def func(a, b):
              return spearmanr(a, b)[0]
  
          return func
      elif method == "pearson":
  
          def func(a, b):
              return np.corrcoef(a, b)[0, 1]
  
          return func
      elif callable(method):
          return method
  
      raise ValueError(
          f"Unknown method '{method}', expected one of "
          "'kendall', 'spearman', 'pearson', or callable"
      )
  
imports: from __future__ import annotations
  import functools
  import itertools
  from typing import Any, Callable, cast
  import warnings
  import numpy
  from pandas._config import get_option
  from pandas._libs import NaT, NaTType, iNaT, lib
  from pandas._typing import ArrayLike, AxisInt, CorrelationMethod, Dtype, DtypeObj, F, Scalar, Shape, npt
  from pandas.compat._optional import import_optional_dependency
  from pandas.util._exceptions import find_stack_level
  from pandas.core.dtypes.common import is_complex, is_float, is_float_dtype, is_integer, is_numeric_dtype, is_object_dtype, needs_i8_conversion, pandas_dtype
  from pandas.core.dtypes.missing import isna, na_value_for_dtype, notna
label_desc: Use image node_id 36 for calling a global function with example usage: get_corr_func(method) and returns: func, kendalltau, func, spearmanr, func, np, method