def decorator_apply(dec, fun):
    """Rewrap `dec` to preserve function signature."""
    import decorator
    return decorator.FunctionMaker.create(fun,
        'return decorated(%(signature)s)', dict(decorated=dec(fun)),
        __wrapped__=fun)
