gut_elements.py: refactor wait_for_*