code: def tri(N, M=None, k=0, dtype=None):
      """Construct (``N``, ``M``) matrix filled with ones at and below the
      ``k``-th diagonal. The matrix has ``A[i,j] == 1`` for ``i <= j + k``.
  
      Args:
          N (int): The size of the first dimension of the matrix.
          M (int, optional): The size of the second dimension of the matrix. If
              ``M`` is None, ``M = N`` is assumed.
          k (int, optional):  Number of subdiagonal below which matrix is filled
              with ones. ``k = 0`` is the main diagonal, ``k < 0`` subdiagonal
              and ``k > 0`` superdiagonal.
          dtype (dtype, optional): Data type of the matrix.
  
      Returns:
          cupy.ndarray: Tri matrix.
  
      .. seealso:: :func:`scipy.linalg.tri`
      """
      warnings.warn(
          "'tri'/'tril/'triu' are deprecated", DeprecationWarning
      )
  
      if M is None:
          M = N
      elif isinstance(M, str):
          # handle legacy interface
          M, dtype = N, M
      # TODO: no outer method
      # m = cupy.greater_equal.outer(cupy.arange(k, N+k), cupy.arange(M))
      # return m if dtype is None else m.astype(dtype, copy=False)
      return cupy.tri(N, M, k, bool if dtype is None else dtype)
  
imports: import math
  import warnings
  import cupy
  from cupy import _core
  from cupyx.scipy.linalg import _uarray
label_desc: Use image node_id 1 for calling a global function with example usage: tri(N, M, k, dtype) and returns: cupy