code: def auc(x, y, reorder=False):
      """Compute Area Under the Curve (AUC) using the trapezoidal rule
  
      This is a general function, given points on a curve.  For computing the
      area under the ROC-curve, see :func:`roc_auc_score`.
  
      Parameters
      ----------
      x : array, shape = [n]
          x coordinates.
  
      y : array, shape = [n]
          y coordinates.
  
      reorder : boolean, optional (default=False)
          If True, assume that the curve is ascending in the case of ties, as for
          an ROC curve. If the curve is non-ascending, the result will be wrong.
  
      Returns
      -------
      auc : float
  
      Examples
      --------
      >>> import numpy as np
      >>> from sklearn import metrics
      >>> y = np.array([1, 1, 2, 2])
      >>> pred = np.array([0.1, 0.4, 0.35, 0.8])
      >>> fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=2)
      >>> metrics.auc(fpr, tpr)
      0.75
  
      See also
      --------
      roc_auc_score : Computes the area under the ROC curve
  
      precision_recall_curve :
          Compute precision-recall pairs for different probability thresholds
  
      """
      check_consistent_length(x, y)
      x = column_or_1d(x)
      y = column_or_1d(y)
  
      if x.shape[0] < 2:
          raise ValueError(
              "At least 2 points are needed to compute"
              " area under curve, but x.shape = %s" % x.shape
          )
  
      direction = 1
      if reorder:
          # reorder the data points according to the x axis and using y to
          # break ties
          order = np.lexsort((y, x))
          x, y = x[order], y[order]
      else:
          dx = np.diff(x)
          if np.any(dx < 0):
              if np.all(dx <= 0):
                  direction = -1
              else:
                  raise ValueError(
                      "Reordering is not turned on, and "
                      "the x array is not increasing: %s" % x
                  )
  
      area = direction * np.trapz(y, x)
      if isinstance(area, np.memmap):
          # Reductions such as .sum used internally in np.trapz do not return a
          # scalar by default for numpy.memmap instances contrary to
          # regular numpy.ndarray instances.
          area = area.dtype.type(area)
      return area
  
imports: from __future__ import division
  import warnings
  import numpy
  from scipy.sparse import csr_matrix
  from ..utils import assert_all_finite
  from ..utils import check_consistent_length
  from ..utils import column_or_1d, check_array
  from ..utils.multiclass import type_of_target
  from ..utils.extmath import stable_cumsum
  from ..utils.fixes import bincount
  from ..utils.fixes import array_equal
  from ..utils.stats import rankdata
  from ..utils.sparsefuncs import count_nonzero
  from ..exceptions import UndefinedMetricWarning
  from .base import _average_binary_score
label_desc: Use image node_id 1 for calling a global function with example usage: auc(x, y, reorder) and returns: area