import time


def timing(f):
    """
    Compute the execution time for function f.
    Add "@timing" on the top of the function to display it.
    """
    def wrap(*args):
        time1 = time.time()
        ret = f(*args)
        time2 = time.time()
        print ('%s function took %0.3f ms' % (f.__name__, (time2-time1)*1000.0))
        return ret
    return wrap