code: def make_scorer(score_func, is_ratio=False, **kwargs):
      """Make a scorer from a 'difference' or 'ratio' metric (e.g.
      :func:`statistical_parity_difference`).
  
      Args:
          score_func (callable): A ratio/difference metric with signature
              ``score_func(y, y_pred, **kwargs)``.
          is_ratio (boolean, optional): Indicates if the metric is ratio or
          difference based.
      """
      if is_ratio:
  
          def score(y, y_pred, **kwargs):
              ratio = score_func(y, y_pred, **kwargs)
              eps = np.finfo(float).eps
              ratio_inverse = 1 / ratio if ratio > eps else eps
              return min(ratio, ratio_inverse)
  
          scorer = _make_scorer(score, **kwargs)
      else:
  
          def score(y, y_pred, **kwargs):
              diff = score_func(y, y_pred, **kwargs)
              return abs(diff)
  
          scorer = _make_scorer(
              score, greater_is_better=False, **kwargs
          )
      return scorer
  
imports: from itertools import permutations
  from typing import Union
  import warnings
  import numpy
  import pandas
  from scipy.special import rel_entr
  from sklearn.metrics import make_scorer, recall_score, precision_score
  from sklearn.metrics import multilabel_confusion_matrix
  from sklearn.metrics._classification import _prf_divide, _check_zero_division
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils import check_X_y
  from aif360.metrics import ot_metric
  from aif360.sklearn.utils import check_inputs, check_groups
  from aif360.detectors.mdss.ScoringFunctions import BerkJones, Bernoulli
  from aif360.detectors.mdss.MDSS import MDSS
label_desc: Use image node_id 5 for calling a global function with example usage: make_scorer(score_func, is_ratio) and returns: scorer, min, abs