Did you mean to bring the time.sleep into the else block?  Maybe I don't understand what's going on here...