code: def get_link_fn_from_str_or_fn(link):
      if isinstance(link, str):
          if link in link_dict:
              link_fn = link_dict[link]
          else:
              raise ValueError(
                  "'link' string does not identify any known"
                  " link functions. "
              )
      elif callable(link):
          if callable(getattr(link, "inverse", None)):
              link_fn = link
          else:
              raise TypeError(
                  "'link' function {} is not valid.".format(link)
              )
  
      return link_fn
  
file_path: cuml/python/cuml/explainer/common.py
imports: from cuml.internals.base import Base
  from cuml.internals.input_utils import input_to_cupy_array
  from pylibraft.common.handle import Handle
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 6 for calling a global function with example usage: get_link_fn_from_str_or_fn(link) and returns: link_fn