code: def get_dataset(
      dataset="iris",
      make_sparse=False,
      add_NaNs=False,
      train_size_maximum=150,
      make_multilabel=False,
      make_binary=False,
      return_target_as_string=False,
  ):
      iris = getattr(sklearn.datasets, "load_%s" % dataset)()
      X = iris.data.astype(np.float32)
      Y = iris.target
  
      if return_target_as_string:
          if (
              make_binary
              or make_multilabel
              or (len(Y.shape) > 1 and Y.shape[1] > 1)
          ):
              raise NotImplementedError()
          Y = np.array([iris.target_names[y] for y in Y])
  
      rs = np.random.RandomState(42)
      indices = np.arange(X.shape[0])
      train_size = min(
          int(len(indices) / 3.0 * 2.0), train_size_maximum
      )
      rs.shuffle(indices)
      X = X[indices]
      Y = Y[indices]
      X_train = X[:train_size]
      Y_train = Y[:train_size]
      X_test = X[train_size:]
      Y_test = Y[train_size:]
  
      if add_NaNs:
          mask = rs.choice([True, False], size=(X_train.shape))
          X_train[mask] = np.NaN
  
      if make_sparse:
          X_train[:, 0] = 0
          X_train[rs.random_sample(X_train.shape) > 0.5] = 0
          X_train = scipy.sparse.csc_matrix(X_train)
          X_train.eliminate_zeros()
          X_test[:, 0] = 0
          X_test[rs.random_sample(X_test.shape) > 0.5] = 0
          X_test = scipy.sparse.csc_matrix(X_test)
          X_test.eliminate_zeros()
  
      if make_binary and make_multilabel:
          raise ValueError(
              "Can convert dataset only to one of the two "
              "options binary or multilabel!"
          )
  
      if make_binary:
          Y_train[Y_train > 1] = 1
          Y_test[Y_test > 1] = 1
  
      if make_multilabel:
          num_classes = len(np.unique(Y))
          Y_train_ = np.zeros((Y_train.shape[0], num_classes))
          for i in range(Y_train.shape[0]):
              Y_train_[i, Y_train[i]] = 1
          Y_train = Y_train_
          Y_test_ = np.zeros((Y_test.shape[0], num_classes))
          for i in range(Y_test.shape[0]):
              Y_test_[i, Y_test[i]] = 1
          Y_test = Y_test_
  
      return X_train, Y_train, X_test, Y_test
  
imports: import importlib
  import inspect
  import os
  import pkgutil
  import numpy
  import scipy.sparse
  import sklearn
  import sklearn.base
  import sklearn.datasets
  import unittest
label_desc: Use image node_id 2 for calling a global function with example usage: get_dataset(dataset, make_sparse, add_NaNs, train_size_maximum, make_multilabel, make_binary, return_target_as_string) and returns: X_train,  Y_train,  X_test,  Y_test