code: def test_add_multi_vrects():
      """Tests ``add_multi_vrects``."""
      periods_df = pd.DataFrame(
          {
              "start_time": [
                  "2019-12-28",
                  "2020-01-25",
                  "2020-01-02",
                  "2020-02-02",
                  "2020-02-05",
              ],
              "end_time": [
                  "2020-01-03",
                  "2020-02-04",
                  "2020-01-05",
                  "2020-02-06",
                  "2020-02-08",
              ],
              "metric": [
                  "impressions",
                  "impressions",
                  "clicks",
                  "clicks",
                  "bookings",
              ],
              "reason": ["C1", "C2", "GCN1", "GCN2", "Lockdown"],
          }
      )
  
      ts = pd.date_range(start="2019-12-15", end="2020-02-15", freq="D")
      df = pd.DataFrame({"ts": ts, "y1": range(len(ts))})
  
      df["y2"] = (df["y1"] - 10) ** (1.5)
  
      fig = plot_lines_markers(
          df=df,
          x_col="ts",
          line_cols=["y1", "y2"],
          marker_cols=None,
          line_colors=None,
          marker_colors=None,
      )
  
      # With multiple groups
      res = add_multi_vrects(
          periods_df=periods_df,
          fig=fig,
          start_time_col="start_time",
          end_time_col="end_time",
          grouping_col="metric",
          y_min=-15,
          y_max=df["y1"].max(),
          annotation_text_col="reason",
          grouping_color_dict=None,
      )
  
      fig = res["fig"]
      grouping_color_dict = res["grouping_color_dict"]
      assert grouping_color_dict == {
          "bookings": "rgba(31, 119, 180, 1.0)",
          "clicks": "rgba(255, 127, 14, 1.0)",
          "impressions": "rgba(44, 160, 44, 1.0)",
      }
      assert len(fig.data) == 2
      assert len(fig.layout.shapes) == 5
  
      # No groups
      fig = plot_lines_markers(
          df=df,
          x_col="ts",
          line_cols=["y1", "y2"],
          marker_cols=None,
          line_colors=None,
          marker_colors=None,
      )
  
      res = add_multi_vrects(
          periods_df=periods_df,
          fig=fig,
          start_time_col="start_time",
          end_time_col="end_time",
          grouping_col=None,
          y_min=-15,
          y_max=df["y1"].max(),
          annotation_text_col="reason",
          opacity=0.4,
          grouping_color_dict=None,
      )
  
      fig = res["fig"]
      grouping_color_dict = res["grouping_color_dict"]
      assert grouping_color_dict == {
          "metric": "rgba(31, 119, 180, 1.0)"
      }
      assert len(fig.data) == 2
      assert len(fig.layout.shapes) == 5
  
      # No groups, no text annotations
      fig = plot_lines_markers(
          df=df,
          x_col="ts",
          line_cols=["y1", "y2"],
          marker_cols=None,
          line_colors=None,
          marker_colors=None,
      )
  
      res = add_multi_vrects(
          periods_df=periods_df,
          fig=fig,
          start_time_col="start_time",
          end_time_col="end_time",
          grouping_col=None,
          y_min=-15,
          y_max=df["y1"].max(),
          annotation_text_col=None,
          opacity=0.4,
          grouping_color_dict=None,
      )
  
      fig = res["fig"]
      grouping_color_dict = res["grouping_color_dict"]
      assert grouping_color_dict == {
          "metric": "rgba(31, 119, 180, 1.0)"
      }
      assert len(fig.data) == 2
      assert len(fig.layout.shapes) == 5
  
      # Tests for raising ``ValueError`` due to non-existing column name
      expected_match = "start_time_col"
      with pytest.raises(ValueError, match=expected_match):
          add_multi_vrects(
              periods_df=periods_df,
              fig=fig,
              start_time_col="start_timestamp",  # This column does not exist
              end_time_col="end_time",
              grouping_col=None,
              y_min=-15,
              y_max=df["y1"].max(),
              annotation_text_col=None,
              opacity=0.4,
              grouping_color_dict=None,
          )
  
imports: import numpy
  import pandas
  import pytest
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import START_TIME_COL
  from greykite.common.python_utils import assert_equal
  from greykite.common.viz.colors_utils import get_distinct_colors
  from greykite.common.viz.timeseries_annotate import add_multi_vrects
  from greykite.common.viz.timeseries_annotate import plot_anomalies_over_forecast_vs_actual
  from greykite.common.viz.timeseries_annotate import plot_event_periods_multi
  from greykite.common.viz.timeseries_annotate import plot_lines_markers
  from greykite.common.viz.timeseries_annotate import plot_overlay_anomalies_multi_metric
  from greykite.common.viz.timeseries_annotate import plot_precision_recall_curve
  from greykite.common.viz.timeseries_annotate import plt_annotate_series
  from greykite.common.viz.timeseries_annotate import plt_compare_series_annotations
label_desc: Use image node_id 7 for calling a global function with example usage: test_add_multi_vrects() without return types