Not 100% sure, but the magic may come from the time.sleep(2) command
time.sleep(2)
See : Arduino Playground - HomePage