human
I wrote the below code

    @functools.wraps(function)
    def decorated_function(self, context, *args, **kwargs):
        try:
            return function(self, context, *args, **kwargs)
        except exception.UnexpectedTaskStateError:
            with excutils.save_and_reraise_exception():
                LOG.exception(_('Possibly    task    preempted.'))
        except Exception:
            with excutils.save_and_reraise_exception():
                try:
                    self._instance_update(context, kwargs['instance']['uuid'], task_state=None)
                except Exception:
                    pass
    return decorated_function

What's a good function header?
assistant
#Here's a good function header.

def reverts_task_state(function):