code: def _one_vs_one_coef(dual_coef, n_support, support_vectors):
      """Generate primal coefficients from dual coefficients
      for the one-vs-one multi class LibSVM in the case
      of a linear kernel."""
  
      # get 1vs1 weights for all n*(n-1) classifiers.
      # this is somewhat messy.
      # shape of dual_coef_ is nSV * (n_classes -1)
      # see docs for details
      n_class = dual_coef.shape[0] + 1
  
      # XXX we could do preallocation of coef but
      # would have to take care in the sparse case
      coef = []
      sv_locs = np.cumsum(np.hstack([[0], n_support]))
      for class1 in range(n_class):
          # SVs for class1:
          sv1 = support_vectors[
              sv_locs[class1] : sv_locs[class1 + 1], :
          ]
          for class2 in range(class1 + 1, n_class):
              # SVs for class1:
              sv2 = support_vectors[
                  sv_locs[class2] : sv_locs[class2 + 1], :
              ]
  
              # dual coef for class1 SVs:
              alpha1 = dual_coef[
                  class2 - 1, sv_locs[class1] : sv_locs[class1 + 1]
              ]
              # dual coef for class2 SVs:
              alpha2 = dual_coef[
                  class1, sv_locs[class2] : sv_locs[class2 + 1]
              ]
              # build weight for class1 vs class2
  
              coef.append(
                  safe_sparse_dot(alpha1, sv1)
                  + safe_sparse_dot(alpha2, sv2)
              )
      return coef
  
imports: from __future__ import print_function
  import numpy
  import scipy.sparse
  import warnings
  from abc import ABCMeta, abstractmethod
  from .None import libsvm, liblinear
  from .None import libsvm_sparse
  from ..base import BaseEstimator, ClassifierMixin
  from ..preprocessing import LabelEncoder
  from ..utils.multiclass import _ovr_decision_function
  from ..utils import check_array, check_consistent_length, check_random_state
  from ..utils import column_or_1d, check_X_y
  from ..utils import compute_class_weight, deprecated
  from ..utils.extmath import safe_sparse_dot
  from ..utils.validation import check_is_fitted
  from ..utils.multiclass import check_classification_targets
  from ..externals import six
  from ..exceptions import ChangedBehaviorWarning
  from ..exceptions import ConvergenceWarning
  from ..exceptions import NotFittedError
label_desc: Use image node_id 1 for calling a global function with example usage: _one_vs_one_coef(dual_coef, n_support, support_vectors) and returns: coef