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
def timer ( fun , * a , ** k ) : @ 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
define a timer for a rule function
    for log and statistic purposes