code: def test_plot_multivariate_grouped():
      """Tests plot_multivariate_grouped function"""
      x_col = "time"
      df = pd.DataFrame(
          {
              x_col: [dt(2018, 1, 1), dt(2018, 1, 2), dt(2018, 1, 3)],
              "y1": [8.5, 2.0, 3.0],
              "y2": [1.4, 2.1, 3.4],
              "y3": [4.2, 3.1, 3.0],
              "y4": [0, 1, 2],
              "y5": [10, 9, 8],
              "group": [1, 2, 1],
          }
      )
  
      # Default values
      fig = plot_multivariate_grouped(
          df=df,
          x_col=x_col,
          y_col_style_dict={
              "y1": {
                  "name": "apple",
                  "legendgroup": "one",
                  "mode": "markers",
                  "line": None,  # Remove line params since we use mode="markers"
              },
              "y2": None,
          },
          grouping_x_col="group",
          grouping_y_col_style_dict={
              "y3": {"line": {"color": "blue"}},
              "y4": {
                  "name": "banana",
                  "line": {"width": 2, "dash": "dot"},
              },
              "y5": None,
          },
          grouping_x_col_values=None,
      )
  
      assert fig.layout.showlegend
      assert fig.layout.xaxis.title.text == x_col
      assert fig.layout.yaxis.title.text == cst.VALUE_COL
      assert fig.layout.title.text == f"{cst.VALUE_COL} vs {x_col}"
      assert len(fig.data) == 8
  
      # In y_col_style dict, names and line colors are kept if given
      assert fig.data[0].name == "apple"
      assert fig.data[0].mode == "markers"
      assert fig.data[0].line.color == DEFAULT_PLOTLY_COLORS[0]
  
      assert fig.data[1].name == "y2"
      assert fig.data[1].mode == "lines"
      assert fig.data[1].line.color == DEFAULT_PLOTLY_COLORS[1]
  
      # In grouped_y_col_style_dict
      # names are augmented with grouping_x_col_value if given, else default name is provided
      # line colors and properties are kept if given, else line color is added
      # group == 1
      assert fig.data[2].name == "1_group_y3"
      assert fig.data[2].mode == "lines"
      assert fig.data[2].line.color == "blue"  # color was provided
  
      assert fig.data[3].name == "1_banana"
      assert fig.data[3].mode == "lines"
      assert fig.data[3].line.color == DEFAULT_PLOTLY_COLORS[2]
      assert fig.data[3].line.width == 2
  
      assert fig.data[4].name == "1_group_y5"
      assert fig.data[4].mode == "lines"
      assert (
          fig.data[4].line.color == DEFAULT_PLOTLY_COLORS[2]
      )  # same color as before
  
      # group == 2
      assert fig.data[5].name == "2_group_y3"
      assert fig.data[5].mode == "lines"
      assert fig.data[5].line.color == "blue"  # color was provided
  
      assert fig.data[6].name == "2_banana"
      assert fig.data[6].mode == "lines"
      assert fig.data[6].line.color == DEFAULT_PLOTLY_COLORS[3]
      assert fig.data[6].line.width == 2
  
      assert fig.data[7].name == "2_group_y5"
      assert fig.data[7].mode == "lines"
      assert (
          fig.data[7].line.color == DEFAULT_PLOTLY_COLORS[3]
      )  # same color as before
  
      # Custom values
      # len(colors) < len(fig.data), hence colors are interpolated
      colors = ["rgb(99, 114, 218)", "rgb(0, 145, 202)"]
      fig = plot_multivariate_grouped(
          df=df,
          x_col=x_col,
          y_col_style_dict={
              "y2": None,
          },
          grouping_x_col="group",
          grouping_y_col_style_dict={
              "y3": {"line": {"color": "blue"}},
              "y5": None,
          },
          grouping_x_col_values=[1],
          colors=colors,
          xlabel="xlab",
          ylabel="ylab",
          title="title",
          showlegend=False,
      )
  
      assert not fig.layout.showlegend
      assert fig.layout.xaxis.title.text == "xlab"
      assert fig.layout.yaxis.title.text == "ylab"
      assert fig.layout.title.text == "title"
  
      assert len(fig.data) == 3
  
      assert fig.data[0].name == "y2"
      assert fig.data[0].line.color == colors[0]
  
      assert fig.data[1].name == "1_group_y3"
      assert fig.data[1].line.color == "blue"  # color was provided
  
      assert fig.data[2].name == "1_group_y5"
      assert fig.data[2].line.color == colors[1]
  
      # Error when grouping_x_col_value is missing
      missing_values = {0, 3}
      with pytest.raises(
          ValueError,
          match=f"Following 'grouping_x_col_values' are missing in "
          f"'group' column: {missing_values}",
      ):
          plot_multivariate_grouped(
              df=df,
              x_col=x_col,
              y_col_style_dict={
                  "y2": None,
              },
              grouping_x_col="group",
              grouping_y_col_style_dict={
                  "y3": None,
              },
              grouping_x_col_values=[0, 1, 3],
          )
  
imports: import datetime
  from datetime import datetime
  from functools import partial
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from plotly.colors import DEFAULT_PLOTLY_COLORS
  from testfixtures import LogCapture
  import greykite.common.constants
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.viz.timeseries_plotting import add_groupby_column
  from greykite.common.viz.timeseries_plotting import flexible_grouping_evaluation
  from greykite.common.viz.timeseries_plotting import grouping_evaluation
  from greykite.common.viz.timeseries_plotting import plot_dual_axis_figure
  from greykite.common.viz.timeseries_plotting import plot_forecast_vs_actual
  from greykite.common.viz.timeseries_plotting import plot_multivariate
  from greykite.common.viz.timeseries_plotting import plot_multivariate_grouped
  from greykite.common.viz.timeseries_plotting import plot_univariate
  from greykite.common.viz.timeseries_plotting import split_range_into_groups
label_desc: Use image node_id 2 for calling a global function with example usage: test_plot_multivariate_grouped() without return types