def timer_wrapper(name):
    'Time counter wrapper.\n    '

    def decorate(func):
        'decorate func\n        '

        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            'wrapper func\n            '
            logging.info(f'[{name}] start...')
            ts = time.time()
            result = func(*args, **kwargs)
            te = time.time()
            costs = (te - ts)
            if (costs < 0.0001):
                cost_str = ('%f sec' % costs)
            elif (costs > 3600):
                cost_str = ('%.4f sec (%.4f hours)' % (costs, (costs / 3600.0)))
            else:
                cost_str = ('%.4f sec' % costs)
            logging.info(f'[{name}] finished! It takes {cost_str} s')
            return result
        return wrapper
    return decorate
Time counter wrapper.
def timer_wrapper(name):
    '\n    '

    def decorate(func):
        'decorate func\n        '

        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            'wrapper func\n            '
            logging.info(f'[{name}] start...')
            ts = time.time()
            result = func(*args, **kwargs)
            te = time.time()
            costs = (te - ts)
            if (costs < 0.0001):
                cost_str = ('%f sec' % costs)
            elif (costs > 3600):
                cost_str = ('%.4f sec (%.4f hours)' % (costs, (costs / 3600.0)))
            else:
                cost_str = ('%.4f sec' % costs)
            logging.info(f'[{name}] finished! It takes {cost_str} s')
            return result
        return wrapper
    return decorate