Just take the wait method from 2.7

This logic will also function correctly
on 2.6 and it ensures we do things in a safe
manner.