def check_expected_type(model, expected_type):
    """Check if a model is of the right type. Raise error if not.

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

    expected_type: Type
        Expected type of the scikit-learn.
    """
    if model.__class__.__name__ != expected_type.__name__:
        raise TypeError(
            "Expected model of type '%s' (got %s)"
            % (expected_type.__name__, model.__class__.__name__)
        )
Check if a model is of the right type. Raise error if not.

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

    expected_type: Type
        Expected type of the scikit-learn.
    
coremltools/converters/sklearn/_sklearn_util.py