def confidence_interval(data, predicts=7, confidence=0.1, p=1, d=0, q=0):
    """Function to find confidence interval of prediction for graph.

    Args:
        data (np.ndarray): Time series data
        predicts (int, optional): [description]. Defaults to 7.
        confidence (float, optional): [description]. Defaults to 0.1.
        p (int, optional): 1st order of ARIMA. Defaults to 1.
        d (int, optional): 2nd order of ARIMA. Defaults to 0.
        q (int, optional): 3rd order of ARIMA. Defaults to 0.

    Returns:
        list, list: Lower bound, upper bound.

    """
    import statsmodels
    if len(data) <= 10:
        return
    order = p, d, q
    try:
        model = statsmodels.tsa.arima_model.ARIMA(data, order=order)
        model_fit = model.fit(disp=0)
        predictions = model_fit.forecast(steps=predicts, alpha=confidence)
        bounds = predictions[2].T
        lower_bound = bounds[0]
        upper_bound = bounds[1]
    except Exception:
        from predictit import data_preparation
        last_value = data[-1]
        data = data_preparation.do_difference(data)
        model = statsmodels.tsa.arima_model.ARIMA(data, order=order)
        model_fit = model.fit(disp=0)
        predictions = model_fit.forecast(steps=predicts, alpha=confidence)
        bounds = predictions[2].T
        lower_bound = data_preparation.inverse_difference(bounds[0], last_value
            )
        upper_bound = data_preparation.inverse_difference(bounds[1], last_value
            )
    return lower_bound, upper_bound
