code: def _calculate_alpha_weighted_metric(
      models: pd.DataFrame,
      alpha_points: Union[float, list[float]],
      performance_metric: str,
      fairness_metric: str,
  ) -> pd.DataFrame:
      """Method to calculate the alpha weighted metric for the given models.
  
      Parameters
      ----------
      models : pd.DataFrame
          DataFrame with the results for the given dataset split.
      alpha_points : Union[float, list[float]]
          Alpha values to use for the bootstrap samples. If float, it is interpreted as a
          single alpha value. If list, it is interpreted as a list of alpha values.
      performance_metric : str
          Name of the performance metric to use.
      fairness_metric : str
          Name of the fairness metric to use.
      """
  
      def calculate_alpha_weighted_score(
          row, alpha, performance_metric, fairness_metric
      ):
          return row[performance_metric] * alpha + row[
              fairness_metric
          ] * (1 - alpha)
  
      if isinstance(alpha_points, float):
          alpha_points = [alpha_points]
  
      models = models.copy()
      for alpha in alpha_points:
          models[f"alpha_{alpha}"] = models.apply(
              calculate_alpha_weighted_score,
              axis=1,
              alpha=alpha,
              performance_metric=performance_metric,
              fairness_metric=fairness_metric,
          )
          models = models.copy()
      return models.copy()
  
file_path: aequitas/src/aequitas/fairflow/utils/evaluation.py
imports: from typing import Literal, Union
  import numpy
  import pandas
  from ..evaluation import Result
label_desc: Use image node_id 2 for calling a global function with example usage: _calculate_alpha_weighted_metric(models, alpha_points, performance_metric, fairness_metric) and returns: models, unknown