code: def _check_square(matrix):
      """Raise a ValueError if the input matrix is square.
  
      Parameters
      ----------
      matrix : numpy.ndarray
          Input array.
  
      """
      if matrix.ndim != 2 or (matrix.shape[0] != matrix.shape[-1]):
          raise ValueError(
              f"Expected a square matrix, got array of shape {matrix.shape}."
          )
  
imports: import warnings
  from math import floor, sqrt
  import numpy
  from scipy import linalg
  from sklearn.base import BaseEstimator, TransformerMixin, clone
  from sklearn.covariance import LedoitWolf
  from nilearn._utils.docs import fill_doc
  from ..None import signal
  from .._utils.extmath import is_spd
label_desc: Use image node_id 1 for calling a global function with example usage: _check_square(matrix) without return types