code: def true_pos_true_neg_rates(y_true, y_pred):
      """A function that returns the true positive rates and the true negatives
      rate. For testing purposes (optimized for readability not performance).
      """
      assert y_pred.shape[0] == y_true.shape[0]
      tp = np.sum((y_pred == 1) * (y_true == 1))
      tn = np.sum((y_pred == -1) * (y_true == -1))
      fn = np.sum((y_pred == -1) * (y_true == 1))
      fp = np.sum((y_pred == 1) * (y_true == -1))
      tpr = tp / (tp + fn)
      tnr = tn / (tn + fp)
      tpr = tpr if not np.isnan(tpr) else 0.0
      tnr = tnr if not np.isnan(tnr) else 0.0
      return tpr, tnr
  
imports: from functools import partial
  import pytest
  from numpy.testing import assert_array_equal
  from scipy.spatial.distance import euclidean
  from metric_learn.base_metric import _PairsClassifierMixin, MahalanobisMixin
  from sklearn.exceptions import NotFittedError
  from sklearn.metrics import f1_score, accuracy_score, fbeta_score, precision_score
  from sklearn.model_selection import train_test_split
  from test.test_utils import pairs_learners, ids_pairs_learners
  from metric_learn.sklearn_shims import set_random_state
  from sklearn import clone
  import numpy
  from itertools import product
label_desc: Use image node_id 10 for calling a global function with example usage: true_pos_true_neg_rates(y_true, y_pred) and returns: tpr,  tnr