Is there a way to get the function a decorator has wrapped?

This my Answer to the stackoverflow question: Is there a way to get the function a decorator has wrapped?:

You can attach the wrapped function to the inner function

In [1]: def wrapper(f):
   ...:     def inner():
   ...:         print "inner"
   ...:     inner._orig = f
   ...:     return inner
   ...: 

In [2]: @wrapper
   ...: def foo():
   ...:     print "foo"
   ...:     
   ...:     

In [3]: foo()
inner

In [4]: foo._orig()
foo