code: def calculate_parity_loss(sub_confusion_matrix_metrics, privileged):
      """
      Calculates parity_loss with formula
      M_parity_loss = sum(|log(M/M_p)|)
  
      where
      M - vector of metrics for each subgroup
      M_p - value in metric for privileged subgroup
      """
      assert isinstance(
          sub_confusion_matrix_metrics, SubgroupConfusionMatrixMetrics
      )
      df_ratio = calculate_ratio(
          sub_confusion_matrix_metrics, privileged
      )
      columns = df_ratio.columns
      df_log = np.log(df_ratio.to_numpy())
      df_absolute_log = abs(df_log)
      df_summed = pd.DataFrame(
          df_absolute_log, index=df_ratio.index.values, columns=columns
      ).apply(sum)
      return df_summed
  
imports: from copy import deepcopy
  import numpy
  import pandas
  from .None import checks
  from ...None import _global_checks
  from ..._explainer import helper
  from ...model_explanations._model_performance import utils
label_desc: Use image node_id 1 for calling a global function with example usage: calculate_parity_loss(sub_confusion_matrix_metrics, privileged) and returns: df_summed