<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def confidence_intervals(self, X, width=.95, quantiles=None):
 """estimate confidence intervals for the model. Parameters X : array-like of shape (n_samples, m_features) Input data matrix width : float on [0,1], optional quantiles : array-like of floats in (0, 1), optional Instead of specifying the prediciton width, one can specify the quantiles. So ``width=.95`` is equivalent to ``quantiles=[.025, .975]`` Returns ------- intervals: np.array of shape (n_samples, 2 or len(quantiles)) Notes ----- Wood 2006, section 4.9 Confidence intervals based on section 4.8 rely on large sample results to deal with non-Gaussian distributions, and treat the smoothing parameters as fixed, when in reality they are estimated from the data. """

        if not self._is_fitted:
            raise AttributeError('GAM has not been fitted. Call fit first.')

        X = check_X(X, n_feats=self.statistics_['m_features'],
                    edge_knots=self.edge_knots_, dtypes=self.dtype,
                    features=self.feature, verbose=self.verbose)

        return self._get_quantiles(X, width, quantiles, prediction=False)