def get_service(self, bundle, reference):
        # type: (Any, ServiceReference) -> Any
        """
        Retrieves the service corresponding to the given reference

        :param bundle: The bundle requiring the service
        :param reference: A service reference
        :return: The requested service
        :raise BundleException: The service could not be found
        """
        with self.__svc_lock:
            if reference.is_factory():
                return self.__get_service_from_factory(bundle, reference)

            # Be sure to have the instance
            try:
                service = self.__svc_registry[reference]

                # Indicate the dependency
                imports = self.__bundle_imports.setdefault(bundle, {})
                imports.setdefault(reference, _UsageCounter()).inc()
                reference.used_by(bundle)
                return service
            except KeyError:
                # Not found
                raise BundleException(
                    "Service not found (reference: {0})".format(reference)
                )
def get_service ( self , bundle , reference ) : with self . __svc_lock : if reference . is_factory ( ) : return self . __get_service_from_factory ( bundle , reference ) try : service = self . __svc_registry [ reference ] imports = self . __bundle_imports . setdefault ( bundle , { } ) imports . setdefault ( reference , _UsageCounter ( ) ) . inc ( ) reference . used_by ( bundle ) return service except KeyError : raise BundleException ( "Service not found (reference: {0})" . format ( reference ) )
Retrieves the service corresponding to the given reference

        :param bundle: The bundle requiring the service
        :param reference: A service reference
        :return: The requested service
        :raise BundleException: The service could not be found