code: def true_negative_rate(
      y_true, y_pred, sample_weight=None, pos_label=None
  ) -> float:
      r"""Calculate the true negative rate (also called specificity or selectivity).
  
      Read more in the :ref:`User Guide <custom_fairness_metrics>`.
  
      Parameters
      ----------
      y_true : array-like
          The list of true values
  
      y_pred : array-like
          The list of predicted values
  
      sample_weight : array-like, optional
          A list of weights to apply to each sample. By default all samples are weighted
          equally
  
      pos_label : scalar, optional
          The value to treat as the 'positive' label in the samples. If `None` (the default)
          then the largest unique value of the y arrays will be used.
  
      Returns
      -------
      float
          The true negative rate for the data
      """
      unique_labels = _get_labels_for_confusion_matrix(
          np.vstack((y_true, y_pred)), pos_label
      )
      tnr, fpr, fnr, tpr = skm.confusion_matrix(
          y_true,
          y_pred,
          sample_weight=sample_weight,
          labels=unique_labels,
          normalize="true",
      ).ravel()
      return tnr
  
file_path: fairlearn/fairlearn/metrics/_base_metrics.py
imports: import numpy
  import sklearn.metrics
  from typing import Any
  from ._metric_frame import check_consistent_length
  from fairlearn.utils._input_manipulations import _convert_to_ndarray_and_squeeze
label_desc: Use image node_id 3 for calling a global function with example usage: true_negative_rate(y_true, y_pred, sample_weight, pos_label) and returns: tnr