code: def cleanup_service(self, factory, svc_registration):
          # type: (Any, ServiceRegistration) -> bool
          
          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
docs: 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