import time now = time.time() future = now + 10 while time.time() < future: # do stuff pass
while True: if time.time() > future: break # do other stuff