def use_ipopo(bundle_context):
    # type: (BundleContext) -> Any
    """
    Utility context to use the iPOPO service safely in a "with" block.
    It looks after the the iPOPO service and releases its reference when
    exiting the context.

    :param bundle_context: The calling bundle context
    :return: The iPOPO service
    :raise BundleException: Service not found
    """
    # Get the service and its reference
    ref_svc = get_ipopo_svc_ref(bundle_context)
    if ref_svc is None:
        raise BundleException("No iPOPO service available")

    try:
        # Give the service
        yield ref_svc[1]
    finally:
        try:
            # Release it
            bundle_context.unget_service(ref_svc[0])
        except BundleException:
            # Service might have already been unregistered
            pass
def use_ipopo ( bundle_context ) : ref_svc = get_ipopo_svc_ref ( bundle_context ) if ref_svc is None : raise BundleException ( "No iPOPO service available" ) try : yield ref_svc [ 1 ] finally : try : bundle_context . unget_service ( ref_svc [ 0 ] ) except BundleException : pass
Utility context to use the iPOPO service safely in a "with" block.
    It looks after the the iPOPO service and releases its reference when
    exiting the context.

    :param bundle_context: The calling bundle context
    :return: The iPOPO service
    :raise BundleException: Service not found