code: def tril(A, k=0, format=None):
      """Returns the lower triangular portion of a matrix in sparse format
  
      Args:
          A (cupy.ndarray or cupyx.scipy.sparse.spmatrix): Matrix whose lower
              triangular portion is desired.
          k (integer): The top-most diagonal of the lower triangle.
          format (string): Sparse format of the result, e.g. 'csr', 'csc', etc.
  
      Returns:
          cupyx.scipy.sparse.spmatrix:
              Lower triangular portion of A in sparse format.
  
      .. seealso:: :func:`scipy.sparse.tril`
      """
      _check_A_type(A)
      A = sparse.coo_matrix(A, copy=False)
      mask = A.row + k >= A.col
      return _masked_coo(A, mask).asformat(format)
  
imports: import cupy
  import cupyx
  from cupyx.scipy import sparse
label_desc: Use image node_id 2 for calling a global function with example usage: tril(A, k, format) and returns: _masked_coo