code: def tocsr(self, copy=False):
      M, N = self.shape
      if M == 0 or N == 0:
          return self._csr_container((M, N), dtype=self.dtype)
  
      # construct indptr array
      if M * N <= np.iinfo(np.int32).max:
          # fast path: it is known that 64-bit indexing will not be needed.
          idx_dtype = np.int32
          indptr = np.empty(M + 1, dtype=idx_dtype)
          indptr[0] = 0
          _csparsetools.lil_get_lengths(self.rows, indptr[1:])
          np.cumsum(indptr, out=indptr)
          nnz = indptr[-1]
      else:
          idx_dtype = self._get_index_dtype(maxval=N)
          lengths = np.empty(M, dtype=idx_dtype)
          _csparsetools.lil_get_lengths(self.rows, lengths)
          nnz = lengths.sum(dtype=np.int64)
          idx_dtype = self._get_index_dtype(maxval=max(N, nnz))
          indptr = np.empty(M + 1, dtype=idx_dtype)
          indptr[0] = 0
          np.cumsum(lengths, dtype=idx_dtype, out=indptr[1:])
  
      indices = np.empty(nnz, dtype=idx_dtype)
      data = np.empty(nnz, dtype=self.dtype)
      _csparsetools.lil_flatten_to_array(self.rows, indices)
      _csparsetools.lil_flatten_to_array(self.data, data)
  
      # init csr matrix
      return self._csr_container(
          (data, indices, indptr), shape=self.shape
      )
  
imports: from bisect import bisect_left
  import numpy
  from ._matrix import spmatrix
  from ._base import _spbase, sparray, issparse
  from ._index import IndexMixin, INT_TYPES, _broadcast_arrays
  from ._sputils import getdtype, isshape, isscalarlike, upcast_scalar, check_shape, check_reshape_kwargs
  from .None import _csparsetools
label_desc: Use image node_id 36 for calling the _lil_base obj's underlying member method code with example usage: obj.tocsr(copy) and returns: self, self