code: def _daal4py_check_weight(self, X, y, sample_weight):
      ww = None
      if sample_weight.shape[0] > 0:
          sample_weight = _check_sample_weight(sample_weight, X)
          if np.all(sample_weight <= 0):
              raise ValueError(
                  "Invalid input - all samples have zero or negative weights."
              )
          if np.any(sample_weight <= 0):
              if len(np.unique(y[sample_weight > 0])) != len(
                  self.classes_
              ):
                  raise ValueError(
                      "Invalid input - all samples with positive weights"
                      " have the same label."
                  )
          ww = sample_weight
      elif self.class_weight is not None:
          ww = np.ones(X.shape[0], dtype=np.float64)
      if self.class_weight is not None:
          for i, v in enumerate(self.class_weight_):
              ww[y == i] *= v
      if ww is not None:
          ww = make2d(ww)
      return ww
  
imports: from __future__ import print_function
  import warnings
  import numpy
  import sklearn.svm._base
  import sklearn.svm._classes
  from scipy import sparse
  from sklearn.utils import check_random_state, check_X_y
  from sklearn.utils.validation import _check_sample_weight, check_is_fitted
  import daal4py
  from .._utils import PatchingConditionsChain, getFPType, make2d, sklearn_check_version
label_desc: Use image node_id 12 for calling a global function with example usage: _daal4py_check_weight(X, y, sample_weight) and returns: ww