code: def test_get_link_fn_from_fn():
      def dummylink(x):
          return 2 * x
  
      # check we raise error if link has no inverse
      with pytest.raises(TypeError):
          get_link_fn_from_str_or_fn(dummylink)
  
      def dummylink_inv(x):
          return x / 2
  
      dummylink.inverse = dummylink_inv
  
      fn = get_link_fn_from_str_or_fn(dummylink)
  
      assert fn(2) == 4
      assert fn.inverse(2) == 1
  
imports: from pylibraft.common.handle import Handle
  from sklearn.linear_model import LinearRegression
  from cuml.datasets import make_regression
  from cuml.testing.utils import ClassEnumerator
  from cuml.explainer.common import model_func_call
  from cuml.explainer.common import link_dict
  from cuml.explainer.common import get_tag_from_model_func
  from cuml.explainer.common import get_link_fn_from_str_or_fn
  from cuml.explainer.common import get_handle_from_cuml_model_func
  from cuml.explainer.common import get_dtype_from_model_func
  from cuml.explainer.common import get_cai_ptr
  from cuml import PCA
  from cuml import LinearRegression
  import pytest
  from cuml.internals.safe_imports import cpu_only_import
  import cuml
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 10 for calling a global function with example usage: test_get_link_fn_from_fn() and returns: unknown, unknown