def remove_resource(admin_mc, request):
    """Remove a resource after a test finishes even if the test fails."""
    client = admin_mc.client

    def _cleanup(resource):
        request.addfinalizer(lambda: client.delete(resource))

    return _cleanup