def timed(func):

    def timed(*args, **dict_args):
        tstart = time.time()
        result = func(*args, **dict_args)
        tend = time.time()
        print("{0} ({1}, {2}) took {3:2.4f} s to execute".format(func.__name__, len(args), len(dict_args), tend - tstart))
        return result

    return timed
Decorator for easy time measurement
dataset/ETHPy150Open kudkudak/learning-wordnet/utils.py/timed