<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sample_grid(self, count=None, step=None):
 """ Return a 3D grid which is contained by the box. Samples are either 'step' distance apart, or there are 'count' samples per box side. Parameters count : int or (3,) int If specified samples are spaced with np.linspace step : float or (3,) float If specified samples are spaced with np.arange Returns grid : (n, 3) float Points inside the box """


        if (count is not None and
                step is not None):
            raise ValueError('only step OR count can be specified!')

        # create pre- transform bounds from extents
        bounds = np.array([-self.primitive.extents,
                           self.primitive.extents]) * .5

        if step is not None:
            grid = util.grid_arange(bounds, step=step)
        elif count is not None:
            grid = util.grid_linspace(bounds, count=count)
        else:
            raise ValueError('either count or step must be specified!')

        transformed = transformations.transform_points(
            grid, matrix=self.primitive.transform)
        return transformed