def mark_key_as_changed_wrapper(parent_method):
    """Decorator that ensures _mark_as_changed method gets called with the key argument"""

    def wrapper(self, key, *args, **kwargs):
        # Can't use super() in the decorator.
        result = parent_method(self, key, *args, **kwargs)
        self._mark_as_changed(key)
        return result

    return wrapper