<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def grid(self, b=None, which='major', axis='both', kind='arbitrary', center=None, **kwargs):
 """ Usage is identical to a normal axes grid except for the ``kind`` and ``center`` kwargs. ``kind="polar"`` will add a polar overlay. The ``center`` and ``kind`` arguments allow you to add a grid from a differently-centered stereonet. This is useful for making "polar stereonets" that still use the same coordinate system as a standard stereonet. (i.e. a plane/line/whatever will have the same representation on both, but the grid is displayed differently.) To display a polar grid on a stereonet, use ``kind="polar"``. It is also often useful to display a grid relative to an arbitrary measurement (e.g. a lineation axis). In that case, use the ``lon_center`` and ``lat_center`` arguments. Note that these are in radians in "stereonet coordinates". Therefore, you'll often want to use one of the functions in ``stereonet_math`` to convert a line/plane/rake into the longitude and latitude you'd input here. For example: ``add_overlay(center=stereonet_math.line(plunge, bearing))``. If no parameters are specified, this is equivalent to turning on the standard grid. """

        grid_on = self._gridOn
        Axes.grid(self, False)

        if kind == 'polar':
            center = 0, 0

        if self._overlay_axes is not None:
            self._overlay_axes.remove()
            self._overlay_axes = None

        if not b and b is not None:
            return

        if b is None:
            if grid_on:
                return

        if center is None or np.allclose(center, (np.pi/2, 0)):
            return Axes.grid(self, b, which, axis, **kwargs)

        self._add_overlay(center)
        self._overlay_axes.grid(True, which, axis, **kwargs)
        self._gridOn = True