code: def _get_blocks(mat, block_len):
      """get diagonal blocks from matrix"""
      k = len(mat)
      idx = np.cumsum(block_len)
      if idx[-1] == k:
          idx = idx[:-1]
      elif idx[-1] > k:
          raise ValueError("sum of block_len larger than shape of mat")
      else:
          # allow one missing block that is the remainder
          pass
      idx_blocks = np.split(np.arange(k), idx)
      blocks = []
      for ii in idx_blocks:
          blocks.append(mat[ii[:, None], ii])
      return blocks, idx_blocks
  
file_path: statsmodels/statsmodels/stats/multivariate.py
imports: import numpy
  from scipy import stats
  from statsmodels.stats.moment_helpers import cov2corr
  from statsmodels.stats.base import HolderTuple
  from statsmodels.tools.validation import array_like
label_desc: Use image node_id 9 for calling a global function with example usage: _get_blocks(mat, block_len) and returns: blocks,  idx_blocks