def __wait_for_ns_phase(self, ns_api, ns, phase, timeout):
    start_time = time.time()
    sleep_time = 1
    max_sleep_time = 7
    while (ns.phase() != phase):
        if ((time.time() - start_time) > timeout):
            raise Exception('Timeout')
        time.sleep(sleep_time)
        if (sleep_time < max_sleep_time):
            sleep_time += 1
        ns = ns_api.get_by_id(ns.id())
    return ns
def __wait_for_ns_phase(self, ns_api, ns, phase, timeout):
    start_time = time.time()
    sleep_time = 1
    max_sleep_time = 7
    while (ns.phase() != phase):
        if ((time.time() - start_time) > timeout):
            raise Exception('Timeout')
        time.sleep(sleep_time)
        if (sleep_time < max_sleep_time):
            sleep_time += 1
        ns = ns_api.get_by_id(ns.id())
    return ns