code: def train_model(x_train, y_train, kernel, C, gamma, degree, coef0):
      """A generic SVM training function, with arguments based on the chosen kernel."""
      if kernel == "linear":
          model = sklearn.svm.SVC(kernel=kernel, C=C)
      elif kernel == "poly":
          model = sklearn.svm.SVC(
              kernel=kernel, C=C, degree=degree, coef0=coef0
          )
      elif kernel == "rbf":
          model = sklearn.svm.SVC(kernel=kernel, C=C, gamma=gamma)
      model.fit(x_train, y_train)
      return model
  
file_path: optunity/bin/examples/python/sklearn/svc_structured.py
imports: import optunity
  import optunity.metrics
  import sklearn.svm
  import numpy
  import time
  from sklearn.datasets import load_digits
label_desc: Use image node_id 2 for calling a global function with example usage: train_model(x_train, y_train, kernel, C, gamma, degree, coef0) and returns: model