<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def timer(fun, *a, **k):
 """ define a timer for a rule function for log and statistic purposes """

    @wraps(fun)
    def timer(*a, **k):
        start = arrow.now()
        ret = fun(*a, **k)
        end = arrow.now()
        print('timer:fun: %s\n start:%s,end:%s, took [%s]' % (
            str(fun), str(start), str(end), str(end - start)))
        return ret
    return timer