Update use wait_for() instead of time.sleep()

Fix line length (flake8)