<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def quantile(self, q=0.5, interpolation='linear'):
 """ Return group values at the given quantile, a la numpy.percentile. Parameters q : float or array-like, default 0.5 (50% quantile) Value(s) between 0 and 1 providing the quantile(s) to compute. interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} Method to use when the desired quantile falls between two points. Returns ------- Series or DataFrame Return type determined by caller of GroupBy object. See Also -------- Series.quantile : Similar method for Series. DataFrame.quantile : Similar method for DataFrame. numpy.percentile : NumPy method to compute qth percentile. Examples -------- val key a 2.0 b 3.0 """


        def pre_processor(
                vals: np.ndarray
        ) -> Tuple[np.ndarray, Optional[Type]]:
            if is_object_dtype(vals):
                raise TypeError("'quantile' cannot be performed against "
                                "'object' dtypes!")

            inference = None
            if is_integer_dtype(vals):
                inference = np.int64
            elif is_datetime64_dtype(vals):
                inference = 'datetime64[ns]'
                vals = vals.astype(np.float)

            return vals, inference

        def post_processor(
                vals: np.ndarray,
                inference: Optional[Type]
        ) -> np.ndarray:
            if inference:
                # Check for edge case
                if not (is_integer_dtype(inference) and
                        interpolation in {'linear', 'midpoint'}):
                    vals = vals.astype(inference)

            return vals

        return self._get_cythonized_result('group_quantile', self.grouper,
                                           aggregate=True,
                                           needs_values=True,
                                           needs_mask=True,
                                           cython_dtype=np.float64,
                                           pre_processing=pre_processor,
                                           post_processing=post_processor,
                                           q=q, interpolation=interpolation)