def _sse_enabled(get_project_from_first_arg=lambda obj: obj.project):  # type: ignore[no-untyped-def]
    """
    Decorator that only call the service function if sse is enabled else return None.
    i.e: settings are configured and the project has sse enabled.

    :param get_project_from_first_arg: function that takes the first argument
        of the decorated function and returns the project object.
    """

    def decorator(service_func):  # type: ignore[no-untyped-def]
        @wraps(service_func)
        def wrapper(*args, **kwargs):  # type: ignore[no-untyped-def]
            project = get_project_from_first_arg(args[0])
            if all(
                [
                    settings.SSE_SERVER_BASE_URL,
                    settings.SSE_AUTHENTICATION_TOKEN,
                    project.enable_realtime_updates,
                ]
            ):
                return service_func(*args, **kwargs)
            return None

        return wrapper

    return decorator

    Decorator that only call the service function if sse is enabled else return None.
    i.e: settings are configured and the project has sse enabled.

    :param get_project_from_first_arg: function that takes the first argument
        of the decorated function and returns the project object.
    
api/sse/sse_service.py