Looks like wait_for_state function is not used anywhere. Cloudsearch1 has the same code and same issue!