def check_fitted(model, func):
    """Check if a model is fitted. Raise error if not.

    Parameters
    ----------
    model: model
        Any scikit-learn model

    func: model
        Function to check if a model is not trained.
    """
    if not func(model):
        raise TypeError("Expected a 'fitted' model for conversion")
Check if a model is fitted. Raise error if not.

    Parameters
    ----------
    model: model
        Any scikit-learn model

    func: model
        Function to check if a model is not trained.
    
coremltools/converters/sklearn/_sklearn_util.py