human
Complete this python program:
def handle_unauthenticated(func):
assistant
#Here is the Python code you requested.

    """Wrap a function to re-authenticate and retry.
    """
    @functools.wraps(func)
    def wrapped(self, *args, **kwargs):
        try:
            return func(self, *args, **kwargs)
        except exception.NotAuthenticated:
            self._authenticate(force_reauth=True)
            return func(self, *args, **kwargs)
    return wrapped