def profile_this(fn):
    def profiled_fn(*args, **kwargs):
        filepath = fn.__name__ % "/tmp/%s.profile"
        prof = cProfile.Profile()
        ret = prof.runcall(fn, *args, **kwargs)
        print("Writing to %s" % filepath)
        prof.dump_stats(filepath)

        print("Printing stats")
        stats = pstats.Stats(filepath)
        stats.sort_stats('cumulative')
        stats.print_stats()

        return ret
    return profiled_fn
dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/profiling/middleware.py/profile_this/swapped operands of `%`