code: def _check_2d_shape(X):
      
      if X.dtype.names is None and len(X.shape) != 2:
          raise ValueError('X needs to be 2-dimensional, not '
                           '{}-dimensional.'.format(len(X.shape)))
docs: Check shape of array or sparse matrix.
  
      Assure that X is always 2D: Unlike numpy we always deal with 2D arrays.