'Fit the estimators.
Parameters
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Training vectors, where n_samples is the number of samples and
n_features is the number of features.
y : array-like, shape = [n_samples]
Target values.
sample_weight : array-like, shape = [n_samples] or None
Sample weights. If None, then samples are equally weighted.
Note that this is supported only if all underlying estimators
support sample weights.
Returns
self : object'

def fit(self, X, y, sample_weight=None):

    if (isinstance(y, np.ndarray) and (len(y.shape) > 1) and (y.shape[1] > 1)):
        raise NotImplementedError('Multilabel    and    multi-output    classification    is    not    supported.')
    if (self.voting not in ('soft', 'hard')):
        raise ValueError(("Voting    must    be    'soft'    or    'hard';    got    (voting=%r)" % self.voting))
    if ((self.estimators is None) or (len(self.estimators) == 0)):
        raise AttributeError('Invalid    `estimators`    attribute,    `estimators`    should    be    a    list    of    (string,    estimator)    tuples')
    if ((self.weights is not None) and (len(self.weights) != len(self.estimators))):
        raise ValueError(('Number    of    classifiers    and    weights    must    be    equal;    got    %d    weights,    %d    estimators' % (len(self.weights), len(self.estimators))))
    if (sample_weight is not None):
        for (name, step) in self.estimators:
            if (not has_fit_parameter(step, 'sample_weight')):
                raise ValueError(("Underlying    estimator    '%s'    does    not    support    sample    weights." % name))
    (names, clfs) = zip(*self.estimators)
    self._validate_names(names)
    n_isnone = np.sum([(clf is None) for (_, clf) in self.estimators])
    if (n_isnone == len(self.estimators)):
        raise ValueError('All    estimators    are    None.    At    least    one    is    required    to    be    a    classifier!')
    self.le_ = LabelEncoder().fit(y)
    self.classes_ = self.le_.classes_
    self.estimators_ = []
    transformed_y = self.le_.transform(y)
    self.estimators_ = Parallel(n_jobs=self.n_jobs)((delayed(_parallel_fit_estimator)(clone(clf), X, transformed_y, sample_weight=sample_weight) for clf in clfs if (clf is not None)))
    return self
