code: def assert_valid_numpy(data):
      __tracebackhide__ = True
      X, y = data.to_numpy()
      assert isinstance(X, np.ndarray), "X is not a numpy array"
      assert isinstance(y, np.ndarray), "y is not a numpy array"
      assert (
          X.ndim == 2 and y.ndim == 1
      ), "X and y dimensions are incorrect"
  
      # Patch pandas and make defaults assertions
      X, y = data.to_data()
      assert isinstance(X, np.ndarray), "to_data does not return numpy"
      assert isinstance(y, np.ndarray), "to_data does not return numpy"
  
      with pytest.raises(DatasetsError):
          data.to_pandas(), "exception not raised when pandas unavailable"
  
imports: import pytest
  import numpy
  from unittest.mock import patch
  from yellowbrick.datasets.loaders import *
  from yellowbrick.datasets.loaders import DATASETS
  from yellowbrick.datasets.base import Dataset, Corpus
  from yellowbrick.datasets.path import dataset_exists, dataset_archive
  from yellowbrick.datasets.path import find_dataset_path
  from yellowbrick.exceptions import DatasetsError
label_desc: Use image node_id 4 for calling a global function with example usage: assert_valid_numpy(data) without return types