python stop and wait simulation