code: def sym_matrix_to_vec(symmetric, discard_diagonal=False):
      """Return the flattened lower triangular part of an array.
  
      If diagonal is kept, diagonal elements are divided by sqrt(2) to conserve
      the norm.
  
      Acts on the last two dimensions of the array if not 2-dimensional.
  
      .. versionadded:: 0.3
  
      Parameters
      ----------
      symmetric : numpy.ndarray or list of numpy arrays, shape\
          (..., n_features, n_features)
          Input array.
  
      discard_diagonal : boolean, default=False
          If True, the values of the diagonal are not returned.
  
      Returns
      -------
      output : numpy.ndarray
          The output flattened lower triangular part of symmetric. Shape is
          (..., n_features * (n_features + 1) / 2) if discard_diagonal is False
          and (..., (n_features - 1) * n_features / 2) otherwise.
  
      """
      if discard_diagonal:
          # No scaling, we directly return the values
          tril_mask = np.tril(
              np.ones(symmetric.shape[-2:]), k=-1
          ).astype(bool)
          return symmetric[..., tril_mask]
      scaling = np.ones(symmetric.shape[-2:])
      np.fill_diagonal(scaling, sqrt(2.0))
      tril_mask = np.tril(np.ones(symmetric.shape[-2:])).astype(bool)
      return symmetric[..., tril_mask] / scaling[tril_mask]
  
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 6 for calling a global function with example usage: sym_matrix_to_vec(symmetric, discard_diagonal) and returns: unknown, symmetric