import time


def timeit(fn):
    """
    Decorator that prints out the duration that a function took to execute.
    
    Arguments:
        fn (function) -- The function to time.
    """
    def modified_fn(*args, **kwargs):
        before = time.time()
        out = fn(*args, **kwargs)
        after = time.time()
        
        delta = (after - before) * 1000
        print("Function duration: {} ms".format(delta))
        
        return out
    
    return modified_fn