docs: def _check_extension_shape(self, Y):
          """Private method to check if new data matches `self.data`
  
          Parameters
          ----------
          Y : array-like, shape=[n_samples_y, n_features_y]
              Input data
  
          Returns
          -------
          Y : array-like, shape=[n_samples_y, n_pca]
              (Potentially transformed) input data
  
          Raises
          ------
          ValueError : if `n_features_y` is not either `self.data.shape[1]` or
          `self.n_pca`.
          """
          if len(Y.shape) != 2:
              raise ValueError("Expected a 2D matrix. Y has shape {}".format(
                  Y.shape))
          if not Y.shape[1] == self.data_nu.shape[1]:
              # try PCA transform
              if Y.shape[1] == self.data.shape[1]:
                  Y = self.transform(Y)
              else:
                  # wrong shape
                  if self.data.shape[1] != self.data_nu.shape[1]:
                      # PCA is possible
                      msg = ("Y must be of shape either "
                             "(n, {}) or (n, {})").format(
                          self.data.shape[1], self.data_nu.shape[1])
                  else:
                      # no PCA, only one choice of shape
                      msg = "Y must be of shape (n, {})".format(
                          self.data.shape[1])
                  raise ValueError(msg)
          return Y