'Get the location of a specific key in an index or model row labels
Parameters
start : label
The key at which to start prediction. Depending on the underlying
model\'s index, may be an integer, a date (string, datetime object,
pd.Timestamp, or pd.Period object), or some other object in the
model\'s row labels.
end : label
The key at which to end prediction (note that this key will be
*included* in prediction). Depending on the underlying
model\'s index, may be an integer, a date (string, datetime object,
pd.Timestamp, or pd.Period object), or some other object in the
model\'s row labels.
index : pd.Index, optional
Optionally an index to associate the predicted results to. If None,
an attempt is made to create an index for the predicted results
from the model\'s index or model\'s row labels.
silent : bool, optional
Argument to silence warnings.
Returns
start : int
The index / observation location at which to begin prediction.
end : int
The index / observation location at which to end in-sample
prediction. The maximum value for this is nobs-1.
out_of_sample : int
The number of observations to forecast after the end of the sample.
prediction_index : pd.Index or None
The index associated with the prediction results. This index covers
the range [start, end + out_of_sample]. If the model has no given
index and no given row labels (i.e. endog/exog is not Pandas), then
this will be None.
Notes
This method expands on `_get_index_loc` by first trying the given
base index (or the model\'s index if the base index was not given) and
then falling back to try again with the model row labels as the base
index.'

def _get_prediction_index(self, start, end, index=None, silent=False):

    try:
        (start, start_index, start_oos) = self._get_index_label_loc(start)
    except KeyError:
        raise KeyError('The    `start`    argument    could    not    be    matched    to    a    location    related    to    the    index    of    the    data.')
    if (end is None):
        end = max(start, (len(self._index) - 1))
    try:
        (end, end_index, end_oos) = self._get_index_label_loc(end)
    except KeyError:
        raise KeyError('The    `end`    argument    could    not    be    matched    to    a    location    related    to    the    index    of    the    data.')
    if isinstance(start, slice):
        start = start.start
    if isinstance(end, slice):
        end = (end.stop - 1)
    prediction_index = end_index[start:]
    if (end < start):
        raise ValueError('Prediction    must    have    `end`    after    `start`.')
    if (index is not None):
        if (not (len(prediction_index) == len(index))):
            raise ValueError('Invalid    `index`    provided    in    prediction.    Must    have    length    consistent    with    `start`    and    `end`    arguments.')
        if ((not isinstance(self.data, data.PandasData)) and (not silent)):
            warnings.warn('Because    the    model    data    (`endog`,    `exog`)    were    not    given    as    Pandas    objects,    the    prediction    output    will    be    Numpy    arrays,    and    the    given    `index`    argument    will    only    be    used    internally.', ValueWarning)
        prediction_index = Index(index)
    elif (self._index_generated and (not self._index_none)):
        if ((self.data.row_labels is not None) and (not (start_oos or end_oos))):
            prediction_index = self.data.row_labels[start:(end + 1)]
        elif (not silent):
            warnings.warn('No    supported    index    is    available.    Prediction    results    will    be    given    with    an    integer    index    beginning    at    `start`.', ValueWarning)
    elif self._index_none:
        prediction_index = None
    if (prediction_index is not None):
        self.data.predict_start = prediction_index[0]
        self.data.predict_end = prediction_index[(-1)]
        self.data.predict_dates = prediction_index
    else:
        self.data.predict_start = None
        self.data.predict_end = None
        self.data.predict_dates = None
    nobs = len(self.endog)
    out_of_sample = max((end - (nobs - 1)), 0)
    end -= out_of_sample
    return (start, end, out_of_sample, prediction_index)
