code: def _build_train_test_data(X, y, datatype, train_ratio=0.9):
      train_selection = np.random.RandomState(42).choice(
          [True, False],
          X.shape[0],
          replace=True,
          p=[train_ratio, 1.0 - train_ratio],
      )
  
      X_train = X[train_selection]
      y_train = y[train_selection]
      X_test = X[~train_selection]
      y_test = y[~train_selection]
  
      if datatype == "dataframe":
          X_train = cudf.DataFrame(X_train)
          y_train = cudf.DataFrame(y_train.reshape(y_train.shape[0], 1))
          X_test = cudf.DataFrame(X_test)
          y_test = cudf.DataFrame(y_test.reshape(y_test.shape[0], 1))
  
      return X_train, X_test, y_train, y_test
  
file_path: cuml/python/cuml/tests/test_kneighbors_classifier.py
imports: from cuml.testing.utils import array_equal
  from cuml.internals.safe_imports import cpu_only_import
  from sklearn.datasets import make_blobs
  from sklearn.neighbors import KNeighborsClassifier
  from cuml.neighbors import KNeighborsClassifier
  import cuml
  import pytest
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 1 for calling a global function with example usage: _build_train_test_data(X, y, datatype, train_ratio) and returns: X_train,  X_test,  y_train,  y_test