def wrap(pre, post):
    """Wrap decorator, to be used to wrap execution of a function with a pre and post function."""
    def decorate(func):
        def call(*args, **kwargs):
            pre(func, *args, **kwargs)
            result = func(*args, **kwargs)
            post(result, func, *args, **kwargs)
            return result
        return call
    return decorate