def look_up_registry(self, integration_id):
        """Find the RemoteRegistry that the user is trying to register the library with,
         and check that it actually exists."""

        registry = RemoteRegistry.for_integration_id(self._db, integration_id,
                                                     self.goal)
        if not registry:
            return MISSING_SERVICE
        return registry
    def look_up_registry(self, integration_id):
        """Find the RemoteRegistry that the user is trying to register the library with,
         and check that it actually exists."""

        registry = RemoteRegistry.for_integration_id(
            self._db, integration_id, self.goal
        )
        if not registry:
            return MISSING_SERVICE
        return registry
    def look_up_service_from_registry(self, protocol, id):
        """Find an existing service, and make sure that the user is not trying to edit
        its protocol."""

        registry = RemoteRegistry.for_integration_id(self._db, id, self.goal)
        if not registry:
            return MISSING_SERVICE
        service = registry.integration
        if protocol != service.protocol:
            return CANNOT_CHANGE_PROTOCOL
        return service
    def look_up_service_from_registry(self, protocol, id):
        """Find an existing service, and make sure that the user is not trying to edit
        its protocol."""

        registry = RemoteRegistry.for_integration_id(self._db, id, self.goal)
        if not registry:
            return MISSING_SERVICE
        service = registry.integration
        if protocol != service.protocol:
            return CANNOT_CHANGE_PROTOCOL
        return service