code: def get_parity_group_report(
      group_value_df,
      attribute,
      fairness_measures,
      fairness_measures_depend,
  ):
      group_value_df = group_value_df.round(2)
      group_value_df = group_value_df.applymap(str)
      def_cols = ["attribute_value"]
      # make copy of relevant rows as new df
      aux_df = group_value_df.loc[
          group_value_df["attribute_name"] == attribute
      ].copy()
  
      metrics = {}
      for par, disp in fairness_measures_depend.items():
          if par in fairness_measures:
              metrics[par] = disp
  
      # getting a reference group label
      for col in aux_df.columns:
          if col in metrics.keys():
              ref_group = metrics[col].replace(
                  "_disparity", "_ref_group_value"
              )
  
              # set value in rows of new df for reference group equal to Ref
              indicate_ref = lambda x, y: x if x != y else "Ref"
              aux_df.loc[:, col] = aux_df[
                  ["attribute_value", ref_group]
              ].apply(lambda x: indicate_ref(*x), axis=1)
  
      map = {}
      aux_df = aux_df[def_cols + fairness_measures]
      for col in aux_df.columns:
          if col == "attribute_value":
              colstr = "Attribute Value"
          else:
              colstr = col
          map[col] = colstr  # + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
          aux_df.loc[:, col] = (
              "["
              + aux_df[col]
              + "]"
              + "(#"
              + "-".join(attribute.lower().split(" "))
              + "-2)"
          )
      aux_df = aux_df.rename(index=str, columns=map)
      cols_order = [
          "Attribute Value",
          "Statistical Parity",
          "Impact Parity",
          "FDR Parity",
          "FPR Parity",
          "FOR Parity",
          "FNR Parity",
      ]
      new_order = [col for col in cols_order if col in aux_df.columns]
      aux_df = aux_df[new_order]
  
      parity_group = tabulate(
          aux_df,
          headers="keys",
          tablefmt="pipe",
          showindex="never",
          numalign="left",
      )
      return parity_group
  
imports: import datetime
  import logging
  import pandas
  from markdown2 import markdown
  from tabulate import tabulate
label_desc: Use image node_id 3 for calling a global function with example usage: get_parity_group_report(group_value_df, attribute, fairness_measures, fairness_measures_depend) and returns: parity_group