import time


def timer(func, args, name=None):
    """Timer function to time the duration of a spesific function func """
    time1 = time.time()
    ret = func(*args)
    time2 = time.time()
    ms = (time2 - time1) * 1000.0
    name = func.__name__ if name == None else name
    print("{}() in {:.2f} ms".format(name, ms))
    return ret