'Fit the model to data.
Fit a separate model for each output variable.
Parameters
X : (sparse) array-like, shape (n_samples, n_features)
Data.
y : (sparse) array-like, shape (n_samples, n_outputs)
Multi-output targets. An indicator matrix turns on multilabel
estimation.
sample_weight : array-like, shape = (n_samples) or None
Sample weights. If None, then samples are equally weighted.
Only supported if the underlying regressor supports sample
weights.
Returns
self : object
Returns self.'

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

    if (not hasattr(self.estimator, 'fit')):
        raise ValueError('The    base    estimator    should    implement    a    fit    method')
    (X, y) = check_X_y(X, y, multi_output=True, accept_sparse=True)
    if is_classifier(self):
        check_classification_targets(y)
    if (y.ndim == 1):
        raise ValueError('y    must    have    at    least    two    dimensions    for    multi-output    regression    but    has    only    one.')
    if ((sample_weight is not None) and (not has_fit_parameter(self.estimator, 'sample_weight'))):
        raise ValueError('Underlying    estimator    does    not    support    sample    weights.')
    self.estimators_ = Parallel(n_jobs=self.n_jobs)((delayed(_fit_estimator)(self.estimator, X, y[:, i], sample_weight) for i in range(y.shape[1])))
    return self
