import time


def timing(f):
    """
    Time of execution for a function.

    Use as decorator::

        @timing
        def function():
            #code
    """
    def wrap(*args):
        time1 = time.time()
        ret = f(*args)
        time2 = time.time()
        print("%s function took %f s" % (f.__name__, (time2 - time1)))
        return ret
    return wrap