code: def a_svm(df_1, y, json_file, trained=True):
      """
      svm training function
      :param df_1: dataframe
      :param y: is the target column
      :trained: whether the model is already trained or not
      :return compiled svm model
      """
  
      degree = 3
      gamma = "scale"
      kernel = "rbf"
  
      if "params" in json_file:
          parameters = json_file["params"]
          if "degree" in json_file["degree"]:
              degree = parameters["degree"]
          if "gamma" in json_file["params"]:
              gamma = parameters["gamma"]
          if "kernel" in json_file["params"]:
              kernel = parameters["kernel"]
  
          clf = svm.SVC(degree=degree, gamma=gamma, kernel=kernel)
  
          if trained:
              clf.fit(df_1, y)
      else:
          param_grid = {
              "C": [0.1, 1, 10, 100],
              "gamma": [1, 0.1, 0.01, 0.001],
              "kernel": ["rbf", "linear"],
          }
          clf = svm.SVC()
          clf.fit(df_1, y)
  
          grid = GridSearchCV(clf, param_grid=param_grid)
          clf = grid.fit(df_1, y)
  
      return clf
  
imports: from sklearn.tree import DecisionTreeClassifier
  from sklearn import svm
  import numpy
  from sklearn.linear_model import SGDClassifier
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.ensemble import GradientBoostingClassifier
  from sklearn.ensemble import AdaBoostClassifier
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.neural_network import MLPClassifier
  from sklearn.metrics import accuracy_score
  from sklearn.ensemble import ExtraTreesClassifier
  from sklearn.model_selection import GridSearchCV, RandomizedSearchCV
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: a_svm(df_1, y, json_file, trained) and returns: clf