<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def restore_grid(func):
 """Wrap ``func`` to preserve the Axes current grid settings. """

    @wraps(func)
    def wrapped_func(self, *args, **kwargs):
        grid = (self.xaxis._gridOnMinor, self.xaxis._gridOnMajor,
                self.yaxis._gridOnMinor, self.yaxis._gridOnMajor)
        try:
            return func(self, *args, **kwargs)
        finally:
            # reset grid
            self.xaxis.grid(grid[0], which="minor")
            self.xaxis.grid(grid[1], which="major")
            self.yaxis.grid(grid[2], which="minor")
            self.yaxis.grid(grid[3], which="major")
    return wrapped_func