import time


def timer(func):
    """ Decorator to measure execution time """

    def wrapper(*args, **kwargs):
        start_time = time.time()
        ret = func(*args, **kwargs)
        elapsed = time.time() - start_time  
        print('{:s}: {:4f} sec'.format(func.__name__, elapsed))
        return ret

    return wrapper