def require_model(f):
    """Decorator to perform check that the model handle exists in the service.
    """

    def wrapper(*args, **kwargs):
        """Function wrapper to perform model handle existence check."""
        if args[0].config.handle():
            return f(*args, **kwargs)
        raise Exception("API requires model to be set")
    return wrapper