code: def _daal4py_kf(kernel, X_fptype, gamma=1.0, is_sparse=False):
      method = "fastCSR" if is_sparse else "defaultDense"
      if kernel == "rbf":
          sigma_value = np.sqrt(0.5 / gamma)
          kf = daal4py.kernel_function_rbf(
              fptype=X_fptype, method=method, sigma=sigma_value
          )
      elif kernel == "linear":
          kf = daal4py.kernel_function_linear(
              fptype=X_fptype, method=method
          )
      else:
          raise ValueError(
              "_daal4py_fit received unexpected kernel specifiction {}.".format(
                  kernel
              )
          )
  
      return kf
  
imports: from __future__ import print_function
  import warnings
  import numpy
  import sklearn.svm._base
  import sklearn.svm._classes
  from scipy import sparse
  from sklearn.calibration import CalibratedClassifierCV
  from sklearn.exceptions import NotFittedError
  from sklearn.model_selection import StratifiedKFold
  from sklearn.utils import check_random_state
  from sklearn.utils.multiclass import _ovr_decision_function
  from sklearn.utils.validation import _check_sample_weight, _num_samples, check_consistent_length, check_is_fitted
  from sklearn import __version__
  import daal4py
  from .._utils import PatchingConditionsChain, getFPType, make2d, sklearn_check_version
label_desc: Use image node_id 11 for calling a global function with example usage: _daal4py_kf(kernel, X_fptype, gamma, is_sparse) and returns: kf