<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unget_service(self, factory, svc_registration, service=None):
 # type: (Any, ServiceRegistration, Any) -> bool """ Releases references to the given service reference :param factory: The service factory :param svc_registration: The ServiceRegistration object :param service: Service instance (for prototype factories) :return: True if all service references to this service factory have been released """

        svc_ref = svc_registration.get_reference()
        try:
            _, counter = self.__factored[svc_ref]
        except KeyError:
            logging.warning(
                "Trying to release an unknown service factory: %s", svc_ref
            )
        else:
            if svc_ref.is_prototype():
                # Notify the factory to clean up this instance
                factory.unget_service_instance(
                    self.__bundle, svc_registration, service
                )

            if not counter.dec():
                # All references have been released: clean up
                del self.__factored[svc_ref]

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

                # No more reference to this service
                return True

        # Some references are still there
        return False