code: def __init__(self, arg1, shape=None, dtype=None, copy=False):
      _spbase.__init__(self)
      self.dtype = getdtype(dtype, arg1, default=float)
  
      # First get the shape
      if issparse(arg1):
          if arg1.format == "lil" and copy:
              A = arg1.copy()
          else:
              A = arg1.tolil()
  
          if dtype is not None:
              A = A.astype(dtype, copy=False)
  
          self._shape = check_shape(A.shape)
          self.dtype = A.dtype
          self.rows = A.rows
          self.data = A.data
      elif isinstance(arg1, tuple):
          if isshape(arg1):
              if shape is not None:
                  raise ValueError("invalid use of shape parameter")
              M, N = arg1
              self._shape = check_shape((M, N))
              self.rows = np.empty((M,), dtype=object)
              self.data = np.empty((M,), dtype=object)
              for i in range(M):
                  self.rows[i] = []
                  self.data[i] = []
          else:
              raise TypeError(
                  "unrecognized lil_array constructor usage"
              )
      else:
          # assume A is dense
          try:
              A = self._ascontainer(arg1)
          except TypeError as e:
              raise TypeError("unsupported matrix type") from e
          else:
              A = self._csr_container(A, dtype=dtype).tolil()
  
              self._shape = check_shape(A.shape)
              self.dtype = A.dtype
              self.rows = A.rows
              self.data = A.data
  
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 1 to create a new _lil_base object from inherited base classes: _spbase, IndexMixin with example: obj = _lil_base(arg1, shape, dtype, copy)