import inspect


def get_wrapped_source(f):
    """
    Gets the text of the source code for the given function
    :param f: Input function
    :return: Source
    """
    if hasattr(f, "__wrapped__"):
        # has __wrapped__, going deep
        return get_wrapped_source(f.__wrapped__)
    else:
        # Returning getsource
        return inspect.getsource(f)