import time


def timing(f):
    """Custom decorator to time how long it takes to execute a function

    Args:
        f (func): Function to be timed

    Returns:
        wrap (any): Closure
    """
    def wrap(*args):
        time1 = time.time()
        ret = f(*args)
        time2 = time.time()
        print(f'{f.__name__} function took {round(time2-time1, 3)} s')

        return ret

    return wrap