code: def compare_two_dfs_on_index(
      dfs, df_labels, index_col, diff_cols=None, relative_diff=False
  ):
      """Calculates difference between two dataframes macthed on a given index.
      One intended application is to compare breakdown dfs from two related ML models
      or same model at different times. However it can be used to compare generic
      dataframes as well.
  
      Parameters
      ----------
      dfs: `list` [`pandas.DataFrame`]
          A list of two dataframes which includes minimally
              - the index column (``index_col``)
              - columns which include the values to be compared.
              If ``diff_cols`` is passed, we expect them to appear in these dataframes.
      df_labels : `list` [`str`]
          A list of two strings denoting the label for each ``df`` respectively.
      index_col : `str`
          The column name of the index column which will be used for joining and
          as x axis of the difference plot.
      diff_cols :  `list` [`str`], default None
          A list of columns to be differenced.
          Each column represents a variable / component to be compared.
          If it is not passed or None, all the columns except for ``index_col`` will
          be used.
      relative_diff : `bool`, default True
          It determines if diff is to be simple diff or relative diff obtained by
          dividing the diff by the absolute values of first dataframe for each value column.
  
      Returns
      -------
      result : `dict`
          A dictionary with following items:
  
              - "diff_df": `pandas.DataFrame`
                  A dataframe which includes the diff for each group / component.
              - "diff_fig": `plotly.graph_objs._figure.Figure`
                  plotly plot overlaying various variable diffs
  
      """
      assert len(dfs) == 2, "We expect two dataframes."
      assert len(df_labels) == 2, "We expect two labels"
      assert list(dfs[0].columns) == list(
          dfs[1].columns
      ), "We expect same column names in both dataframes"
      assert (
          index_col in dfs[0].columns
      ), "`index_col` must be found in both dataframes."
      assert (
          index_col in dfs[1].columns
      ), "`index_col` must be found in both dataframes."
  
      diff_df = pd.merge(dfs[0], dfs[1], on=index_col)
  
      if diff_cols is None:
          diff_cols = list(dfs[0].columns)
          diff_cols.remove(index_col)
  
      y_label = "diff"
      for col in diff_cols:
          diff_df[col] = diff_df[f"{col}_y"] - diff_df[f"{col}_x"]
          if relative_diff:
              diff_df[col] = diff_df[col] / abs(diff_df[f"{col}_x"])
              y_label = "relative diff"
  
      diff_df = diff_df[[index_col] + diff_cols]
  
      diff_fig = plot_multivariate(
          df=diff_df,
          x_col=index_col,
          title=f"change in variables from {df_labels[0]} to {df_labels[1]}",
          ylabel=y_label,
      )
  
      return {"diff_df": diff_df, "diff_fig": diff_fig}
  
label_desc: Use image node_id 1 for calling a global function with example usage: compare_two_dfs_on_index(dfs, df_labels, index_col, diff_cols, relative_diff) and returns: dict