code: def _compressed_sparse_stack(blocks, axis):
      """
      Stacking fast path for CSR/CSC matrices
      (i) vstack for CSR, (ii) hstack for CSC.
      """
      other_axis = 1 if axis == 0 else 0
      data = np.concatenate([b.data for b in blocks])
      constant_dim = blocks[0].shape[other_axis]
      idx_dtype = get_index_dtype(
          arrays=[b.indptr for b in blocks],
          maxval=max(data.size, constant_dim),
      )
      indices = np.empty(data.size, dtype=idx_dtype)
      indptr = np.empty(
          sum(b.shape[axis] for b in blocks) + 1, dtype=idx_dtype
      )
      last_indptr = idx_dtype(0)
      sum_dim = 0
      sum_indices = 0
      for b in blocks:
          if b.shape[other_axis] != constant_dim:
              raise ValueError(
                  "incompatible dimensions for axis %d" % other_axis
              )
          indices[
              sum_indices : sum_indices + b.indices.size
          ] = b.indices
          sum_indices += b.indices.size
          idxs = slice(sum_dim, sum_dim + b.shape[axis])
          indptr[idxs] = b.indptr[:-1]
          indptr[idxs] += last_indptr
          sum_dim += b.shape[axis]
          last_indptr += b.indptr[-1]
      indptr[-1] = last_indptr
      if axis == 0:
          return csr_matrix(
              (data, indices, indptr), shape=(sum_dim, constant_dim)
          )
      else:
          return csc_matrix(
              (data, indices, indptr), shape=(constant_dim, sum_dim)
          )
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from scipy._lib._numpy_compat import get_randint
  from scipy._lib.six import xrange
  from .sputils import upcast, get_index_dtype, isscalarlike
  from .csr import csr_matrix
  from .csc import csc_matrix
  from .bsr import bsr_matrix
  from .coo import coo_matrix
  from .dia import dia_matrix
  from .base import issparse
label_desc: Use image node_id 7 for calling a global function with example usage: _compressed_sparse_stack(blocks, axis) and returns: csr_matrix, csc_matrix