def METHOD_NAME(*, db_session, plugin_instance_id: int) -> Optional[PluginInstance]:
    """Returns a plugin instance based on the given instance id."""
    return (
        db_session.query(PluginInstance)
        .filter(PluginInstance.id == plugin_instance_id)
        .one_or_none()
    )