Implementation of a stopwatch in Python