def refresh_wrapper(trynum, maxtries, *args, **kwargs):
    """A @retry argmod_func to refresh a Wrapper, which must be the first arg.

    When using @retry to decorate a method which modifies a Wrapper, a common
    cause of retry is etag mismatch.  In this case, the retry should refresh
    the wrapper before attempting the modifications again.  This method may be
    passed to @retry's argmod_func argument to effect such a refresh.

    Note that the decorated method must be defined such that the wrapper is its
    first argument.
    """
    arglist = list(args)
    # If we get here, we *usually* have an etag mismatch, so specifying
    # use_etag=False *should* be redundant.  However, for scenarios where we're
    # retrying for some other reason, we want to guarantee a fresh fetch to
    # obliterate any local changes we made to the wrapper (because the retry
    # should be making those changes again).
    arglist[0] = arglist[0].refresh(use_etag=False)
    return arglist, kwargs