def call_after(lag):
def decorator(func):<EOL><INDENT>@wraps(func)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>wrapper.timer.cancel() <EOL>wrapper.timer = threading.Timer(lag, func, args=args, kwargs=kwargs)<EOL>wrapper.timer.start()<EOL><DEDENT>wrapper.timer = threading.Timer(<NUM_LIT:0>, lambda: None) <EOL>return wrapper<EOL><DEDENT>return decorator<EOL>
Parametrized decorator for calling a function after a time ``lag`` given
in milliseconds. This cancels simultaneous calls.