<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cleanup_service(self, factory, svc_registration):
 # type: (Any, ServiceRegistration) -> bool """ If this bundle used that factory, releases the reference; else does nothing :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: True if the bundle was using the factory, else False """

        svc_ref = svc_registration.get_reference()
        try:
            # "service" for factories, "services" for prototypes
            services, _ = self.__factored.pop(svc_ref)
        except KeyError:
            return False
        else:
            if svc_ref.is_prototype() and services:
                for service in services:
                    try:
                        factory.unget_service_instance(
                            self.__bundle, svc_registration, service
                        )
                    except Exception:
                        # Ignore instance-level exceptions, potential errors
                        # will reappear in unget_service()
                        pass

            # Call the factory
            factory.unget_service(self.__bundle, svc_registration)

            # No more association
            svc_ref.unused_by(self.__bundle)
            return True