Python: Wait function - python