def interval_timed(interval):
def decorator(f):<EOL><INDENT>@wraps(f)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>stopped = Event()<EOL>def loop():  <EOL><INDENT>while not stopped.wait(interval):  <EOL><INDENT>f(*args, **kwargs)<EOL><DEDENT><DEDENT>t = Thread(name='<STR_LIT>', target=loop)<EOL>t.daemon = True  <EOL>t.start()<EOL>return stopped.set<EOL><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
Interval timer decorator.

    Taken from: http://stackoverflow.com/questions/12435211/python-threading-timer-repeat-function-every-n-seconds/12435256