def METHOD_NAME(cls, library):
    """Find the appropriate CustomIndexView for the given library."""
    _db = Session.object_session(library)
    integration = ExternalIntegration.one_for_library_and_goal(
        _db, library, cls.GOAL
    )
    if not integration:
        return None
    protocol = integration.protocol
    if not protocol in cls.BY_PROTOCOL:
        raise CannotLoadConfiguration(
            "Unregistered custom index protocol: %s" % protocol
        )
    view_class = cls.BY_PROTOCOL[protocol]
    return view_class(library, integration)