def get_orig_function(f):
    """Make use of the __wrapped__ attribute to find the original function
    of a decorated function."""
    try:
        while True:
            f = f.__wrapped__
    except AttributeError:
        return f