import org.osgi.framework.FrameworkUtil # Get the package context bundle_context = FrameworkUtil.getBundle(this.getClass()).bundleContext # Get the service reference service_reference = bundle_context.getServiceReference("my.service.interface") # Check if the service reference has a property ending with ".example" if service_reference.getPropertyKeys().any(lambda k: k.endswith(".example")): # Do something with the service service = bundle_context.getService(service_reference) ...In this example, we first get the bundle context and retrieve a service reference for an interface named "my.service.interface". We then use the endswith method to check if any of the properties of the service reference end with ".example". If so, we retrieve the service and perform some action with it. The package library for this example is likely to be Eclipse Equinox, which is a popular OSGi framework implementation.