'Wait until getting the resource raises NotFound exception.
:param resource: Resource object.
:param manager: Manager object with get method.
:param timeout: timeout in seconds
:param poll_interval: poll interval in seconds'

def wait_for_resource_delete(self, resource, manager, timeout=60, poll_interval=1):

    start_time = time.time()
    while ((time.time() - start_time) < timeout):
        try:
            manager.get(resource)
        except Exception as e:
            if (getattr(e, 'http_status', None) == 404):
                break
            else:
                raise
        time.sleep(poll_interval)
    else:
        self.fail(("The    resource    '%s'    still    exists." % resource.id))
