code: def specificity(links_true, links_pred=None, total=None):
      
  
      if _isconfusionmatrix(links_true):
  
          confusion_matrix = links_true
  
          v = confusion_matrix[1, 1] / \
              (confusion_matrix[1, 0] + confusion_matrix[1, 1])
      else:
  
          fp = false_positives(links_true, links_pred)
          tn = true_negatives(links_true, links_pred, total)
          v = tn / (fp + tn)
  
      return float(v)
docs: specificity(links_true, links_pred, total)
  
      Compute the specificity.
  
      The specificity is given by TN/(FP+TN).
  
      Parameters
      ----------
      links_true: pandas.MultiIndex, pandas.DataFrame, pandas.Series
          The true (or actual) collection of links.
      links_pred: pandas.MultiIndex, pandas.DataFrame, pandas.Series
          The predicted collection of links.
      total: int, pandas.MultiIndex
          The count of all record pairs (both links and non-links). When the
          argument is a pandas.MultiIndex, the length of the index is used.
  
      Returns
      -------
      float
          The specificity