<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def predict(self, n_periods=10, exogenous=None, return_conf_int=False, alpha=0.05):
 """Forecast future values Generate predictions (forecasts) ``n_periods`` in the future. Note that if ``exogenous`` variables were used in the model fit, they will be expected for the predict procedure and will fail otherwise. Parameters n_periods : int, optional (default=10) The number of periods in the future to forecast. exogenous : array-like, shape=[n_obs, n_vars], optional (default=None) An optional 2-d array of exogenous variables. If provided, these variables are used as additional features in the regression operation. This should not include a constant or trend. Note that if an ``ARIMA`` is fit on exogenous features, it must be provided exogenous features for making predictions. return_conf_int : bool, optional (default=False) Whether to get the confidence intervals of the forecasts. alpha : float, optional (default=0.05) The confidence intervals for the forecasts are (1 - alpha) % Returns ------- forecasts : array-like, shape=(n_periods,) The array of fore-casted values. conf_int : array-like, shape=(n_periods, 2), optional The confidence intervals for the forecasts. Only returned if ``return_conf_int`` is True. """

        check_is_fitted(self, 'arima_res_')
        if not isinstance(n_periods, (int, long)):
            raise TypeError("n_periods must be an int or a long")

        # if we fit with exog, make sure one was passed:
        exogenous = self._check_exog(exogenous)  # type: np.ndarray
        if exogenous is not None and exogenous.shape[0] != n_periods:
            raise ValueError('Exogenous array dims (n_rows) != n_periods')

        # ARIMA/ARMA predict differently...
        if not self._is_seasonal():
            # use the results wrapper to predict so it injects its own params
            # (also if I was 0, ARMA will not have a forecast method natively)
            f, _, conf_int = self.arima_res_.forecast(
                steps=n_periods, exog=exogenous, alpha=alpha)
        else:  # SARIMAX
            # Unfortunately, SARIMAX does not really provide a nice way to get
            # the confidence intervals out of the box, so we have to perform
            # the get_prediction code here and unpack the confidence intervals
            # manually.
            # f = self.arima_res_.forecast(steps=n_periods, exog=exogenous)
            arima = self.arima_res_
            end = arima.nobs + n_periods - 1
            results = arima.get_prediction(start=arima.nobs,
                                           end=end,
                                           exog=exogenous)
            f = results.predicted_mean
            conf_int = results.conf_int(alpha=alpha)

        if return_conf_int:
            # The confidence intervals may be a Pandas frame if it comes from
            # SARIMAX & we want Numpy. We will to duck type it so we don't add
            # new explicit requirements for the package
            return f, check_array(conf_int, force_all_finite=False)
        return f