code: def _set_kernel(model, spec):
      """
      Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model.
      """
  
      def gamma_value(model):
          return model._gamma
  
      result = None
      if model.kernel == "linear":
          spec.kernel.linearKernel.MergeFromString(
              b""
          )  # hack to set kernel to an empty type
      elif model.kernel == "rbf":
          spec.kernel.rbfKernel.gamma = gamma_value(model)
      elif model.kernel == "poly":
          spec.kernel.polyKernel.gamma = gamma_value(model)
          spec.kernel.polyKernel.c = model.coef0
          spec.kernel.polyKernel.degree = model.degree
      elif model.kernel == "sigmoid":
          spec.kernel.sigmoidKernel.gamma = gamma_value(model)
          spec.kernel.sigmoidKernel.c = model.coef0
      else:
          raise ValueError(
              "Unsupported kernel. The following kernel are supported: linear, RBF, polynomial and sigmoid."
          )
      return result
  
label_desc: Use image node_id 1 for calling a global function with example usage: _set_kernel(model, spec) and returns: result, model