<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def y_grid(self, grid=None):
 """The vertical lines that run accross the chart from the y-ticks. If a boolean value is given, these gridlines will be turned on or off. Otherwise, the method will return their current state. :param bool grid: Turns the gridlines on or off. :rtype: ``bool``"""


        if grid is None:
            return self._y_grid
        else:
            if not isinstance(grid, bool):
                raise TypeError("grid must be boolean, not '%s'" % grid)
            self._y_grid = grid