import functools


def pub(f):
    """ Decorator wraps functions that should provide notifications
    to observers when executed.

    Returns: A wrapped version of the decorated function.
    """
    @functools.wraps(f)
    def pub_action_wrapper(*args, **kwargs):
        args[0].publisher.pub(f.__name__, *args, **kwargs)
        return f(*args, **kwargs)

    return pub_action_wrapper