@staticmethod
def train_model(model, X, y, classes=None, sample_weight=None):
    """ Trains a model, taking care of the fact that either fit or partial_fit is implemented

        Parameters
        ----------
        model: StreamModel or sklearn.BaseEstimator
            The model to train
        X: numpy.ndarray of shape (n_samples, n_features)
            The data chunk
        y: numpy.array of shape (n_samples)
            The labels in the chunk
        classes: list or numpy.array
            The unique classes in the data chunk
        sample_weight: float or array-like
            Instance weight. If not provided, uniform weights are assumed.

        Returns
        -------
        StreamModel or sklearn.BaseEstimator
            The trained model
        """
    try:
        model.fit(X, y)
    except NotImplementedError:
        model.partial_fit(X, y, classes, sample_weight)
    return model
