def deprecated(obj=None, suffix="", version="", obj_prefix=""):
    """
    Decorator to mark a function or a class as deprecated
    """

    def decorator_deprecation_warning(obj):
        @functools.wraps(obj)
        def wrapped(*args, **kwargs):
            if isinstance(obj, type):
                msg = (
                    f"Class {obj_prefix}{obj.__name__} is deprecated and will be removed in {version}."
                )
            else:
                msg = (
                    f"Function {obj_prefix}{obj.__name__} is deprecated and will be removed in {version}."
                )
            if suffix:
                msg += f"; {suffix}"
            warnings.warn(msg, category=DeprecationWarning)
            return obj(*args, **kwargs)

        return wrapped

    if obj is None:
        return decorator_deprecation_warning

    return decorator_deprecation_warning(obj)

    Decorator to mark a function or a class as deprecated
    
coremltools/models/_deprecation.py