def METHOD_NAME(
    *, db_session, slug: str, project_id=None
) -> Optional[PluginInstance]:
    """Fetches the current active plugin for the given type."""
    return (
        db_session.query(PluginInstance)
        .join(Plugin)
        .filter(Plugin.slug == slug)
        .filter(PluginInstance.project_id == project_id)
        .filter(PluginInstance.enabled == True)  # noqa
        .one_or_none()
    )