code: def _getnnz(self, axis=None):
      if axis is None:
          return sum([len(rowvals) for rowvals in self.data])
      if axis < 0:
          axis += 2
      if axis == 0:
          out = np.zeros(self.shape[1], dtype=np.intp)
          for row in self.rows:
              out[row] += 1
          return out
      elif axis == 1:
          return np.array(
              [len(rowvals) for rowvals in self.data], dtype=np.intp
          )
      else:
          raise ValueError("axis out of bounds")
  
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 6 for calling the _lil_base obj's underlying member method code with example usage: obj._getnnz(axis) and returns: sum, out, np