code: def nan_roc_auc_score(
      y_true, y_score, average="macro", sample_weight=None
  ):
      if len(np.unique(y_true)) != 2:
          return np.nan
      else:
          return roc_auc_score(
              y_true,
              y_score,
              average=average,
              sample_weight=sample_weight,
          )
  
imports: import numpy
  import pandas
  from numpy import nan
  from numpy.testing import assert_almost_equal
  from packaging.version import Version
  from sklearn import __version__
  from sklearn.datasets import load_iris
  from sklearn.decomposition import PCA
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.linear_model import LinearRegression
  from sklearn.metrics import accuracy_score, make_scorer, roc_auc_score
  from sklearn.model_selection import GridSearchCV, GroupKFold
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.pipeline import Pipeline
  from mlxtend.classifier import SoftmaxRegression
  from mlxtend.data import boston_housing_data
  from mlxtend.feature_selection import SequentialFeatureSelector
  from mlxtend.utils import assert_raises
label_desc: Use image node_id 1 for calling a global function with example usage: nan_roc_auc_score(y_true, y_score, average, sample_weight) and returns: np, roc_auc_score