code: def _get_labels_for_confusion_matrix(labels, pos_label):
      r"""Figure out the labels argument for skm.confusion_matrix.
  
      This is an internal method used by the true/false positive/negative
      rate metrics (and hence are restricted to binary data). We compute
      these using the confusion matrix.
      This method prepares the `labels` argument of
      :py:func:`sklearn.metrics.confusion_matrix` based on the
      user's specifications.
  
      Parameters
      ----------
      labels : array-like
          Labels provided by the user
  
      pos_label : scalar
          The value in the true and predicted arrays to treat as positive.
          If this is not set, then the unique_labels must be a subset of
          {0, 1} or {-1, 1}, and it will then be set to 1
  
      Returns
      -------
      list
          A two element list, consisting of the unique labels
          with the positive label listed last. This array will
          always be two elements, even if the unique_labels array
          only has one element.
      """
      unique_labels = list(np.unique(labels))
  
      # Set pos_label if needed
      if pos_label is None:
          labels01 = frozenset([0, 1])
          labels11 = frozenset([-1, 1])
          if labels01.issuperset(unique_labels) or labels11.issuperset(
              unique_labels
          ):
              pos_label = 1
          else:
              raise ValueError(_RESTRICTED_VALS_IF_POS_LABEL_NONE)
  
      # Ensure unique_labels has two elements
      if len(unique_labels) == 1:
          if unique_labels[0] == pos_label:
              unique_labels = [np.iinfo(np.int64).min, pos_label]
          else:
              unique_labels.append(pos_label)
      elif len(unique_labels) == 2:
          if pos_label == unique_labels[0]:
              unique_labels = list(reversed(unique_labels))
          elif pos_label == unique_labels[1]:
              pass
          else:
              raise ValueError(_NEED_POS_LABEL_IN_Y_VALS)
      else:
          raise ValueError(_TOO_MANY_UNIQUE_Y_VALS)
  
      return unique_labels
  
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 1 for calling a global function with example usage: _get_labels_for_confusion_matrix(labels, pos_label) and returns: unique_labels