def METHOD_NAME(func):
    @wraps(func)
    def inner(*args, **kwargs):
        for _ in range(max_times - 1):
            try:
                return func(*args, **kwargs)
            except error_types as err:
                logger.debug(f"Retrying due to error: {err}")
        # Allow the exception on the last try to bubble up
        return func(*args, **kwargs)
    return inner