Is there any way to wrap function call in Python?
I've tried the following:

Code:
def wrap(f, wrapper):

    def h(*args, **opts):  pass
    h.func_code = f.func_code

    def w(*args, **opts):
        wrapper(args, opts)
        return h(args, opts)
    
    f.func_code = w.func_code
    return w


def test_f():
    print 'test_f()'
...