code: def get_corr_func(method):
      if method in ["kendall", "spearman"]:
          from scipy.stats import kendalltau, spearmanr
      elif callable(method):
          return method
  
      def _pearson(a, b):
          return np.corrcoef(a, b)[0, 1]
  
      def _kendall(a, b):
          rs = kendalltau(a, b)
          if isinstance(rs, tuple):
              return rs[0]
          return rs
  
      def _spearman(a, b):
          return spearmanr(a, b)[0]
  
      _cor_methods = {
          "pearson": _pearson,
          "kendall": _kendall,
          "spearman": _spearman,
      }
      return _cor_methods[method]
  
imports: from distutils.version import LooseVersion
  import functools
  import itertools
  import operator
  import warnings
  import numpy
  from pandas._libs import iNaT, lib, tslibs
  import pandas.compat
  from pandas.core.dtypes.cast import _int64_max, maybe_upcast_putmask
  from pandas.core.dtypes.common import _get_dtype, is_any_int_dtype, is_bool_dtype, is_complex, is_complex_dtype, is_datetime64_dtype, is_datetime64tz_dtype, is_datetime_or_timedelta_dtype, is_float, is_float_dtype, is_integer, is_integer_dtype, is_numeric_dtype, is_object_dtype, is_scalar, is_timedelta64_dtype, pandas_dtype
  from pandas.core.dtypes.dtypes import DatetimeTZDtype
  from pandas.core.dtypes.missing import isna, na_value_for_dtype, notna
  import pandas.core.common
  from pandas.core.config import get_option
label_desc: Use image node_id 30 for calling a global function with example usage: get_corr_func(method) and returns: _cor_methods, np, rs, spearmanr, method, rs