code: def plot_predictions_with_confidence(
      data: pd.Series,
      predictions: List[pd.DataFrame],
      fig_defaults: Dict[str, Any],
      model_labels: Optional[str] = None,
      data_kwargs: Optional[Dict] = None,
      fig_kwargs: Optional[Dict] = None,
  ) -> PlotReturnType:
      """Plots the original data and the predictions provided with confidence
      TODO: Refactor and fill docstring
      """
      if len(predictions) != 1:
          raise ValueError(
              "Plotting with predictions only supports one estimator. Please pass only one estimator to fix"
          )
  
      preds = predictions[0]["y_pred"]
      upper_interval = predictions[0]["upper"]
      lower_interval = predictions[0]["lower"]
      model_label = model_labels[0]
  
      data_kwargs = data_kwargs or {}
      fig_kwargs = fig_kwargs or {}
  
      title = "Actual vs. 'Out-of-Sample' Forecast"
      time_series_name = data.name
      if time_series_name is not None:
          title = f"{title} | {time_series_name}"
  
      x = (
          upper_interval.index.to_timestamp()
          if isinstance(upper_interval.index, pd.PeriodIndex)
          else upper_interval.index
      )
      upper_bound = go.Scatter(
          name=f"Prediction Interval | {model_label}",  # Changed since we use only 1 legend
          x=x,
          y=upper_interval,
          mode="lines",
          marker=dict(color="#68BBE3"),
          line=dict(width=0),
          fillcolor="rgba(104,187,227,0.5)",  # eq to # fillcolor="#68BBE3" with alpha,
          showlegend=True,
          fill="tonexty",
      )
  
      x = (
          preds.index.to_timestamp()
          if isinstance(preds.index, pd.PeriodIndex)
          else preds.index
      )
      mean = go.Scatter(
          name=f"Forecast | {model_label}",
          x=x,
          y=preds,
          mode="lines+markers",
          line=dict(color="#1f77b4"),
          marker=dict(size=5),
          showlegend=True,
      )
  
      x = (
          data.index.to_timestamp()
          if isinstance(data.index, pd.PeriodIndex)
          else data.index
      )
      original = go.Scatter(
          name="Original",
          x=x,
          y=data,
          mode="lines+markers",
          marker=dict(size=5, color="#3f3f3f"),
          showlegend=True,
      )
  
      x = (
          lower_interval.index.to_timestamp()
          if isinstance(lower_interval.index, pd.PeriodIndex)
          else lower_interval.index
      )
      lower_bound = go.Scatter(
          name="Lower Interval",
          x=x,
          y=lower_interval,
          marker=dict(color="#68BBE3"),
          line=dict(width=0),
          mode="lines",
          showlegend=False,  # Not outputting since we need only 1 legend for interval
      )
  
      data = [mean, lower_bound, upper_bound, original]
  
      layout = go.Layout(
          yaxis=dict(title="Values"),
          xaxis=dict(title="Time"),
          title=title,
      )
  
      fig = go.Figure(data=data, layout=layout)
  
      fig = _plot_fig_update(
          fig, title, fig_defaults, fig_kwargs, show_legend=True
      )
  
      return_data_dict = {
          "data": data,
          "predictions": predictions,
          "upper_interval": upper_interval,
          "lower_interval": lower_interval,
      }
  
      return fig, return_data_dict
  
file_path: pycaret/pycaret/internal/plots/time_series.py
imports: from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  from sktime.forecasting.model_selection import ExpandingWindowSplitter, SlidingWindowSplitter
  from pycaret.internal.plots.utils.time_series import PlotReturnType, _clean_model_results_labels, _get_subplot_rows_cols, _plot_fig_update, _resolve_hoverinfo, _update_fig_dimensions, corr_subplot, decomp_subplot, dist_subplot, frequency_components_subplot, plot_original_with_overlays, qq_subplot, time_series_subplot
  from pycaret.utils.generic import _resolve_dict_keys
  from pycaret.utils.time_series import get_diffs
label_desc: Use image node_id 7 for calling a global function with example usage: plot_predictions_with_confidence(data, predictions, fig_defaults, model_labels, data_kwargs, fig_kwargs) and returns: fig,  return_data_dict