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
  
      Parameters
      ----------
      N : int
          The size of the first dimension of the matrix.
      M : int or None, 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
      -------
      tri : (N, M) ndarray
          Tri matrix.
  
      Examples
      --------
      >>> from scipy.linalg import tri
      >>> tri(3, 5, 2, dtype=int)
      array([[1, 1, 1, 0, 0],
             [1, 1, 1, 1, 0],
             [1, 1, 1, 1, 1]])
      >>> tri(3, 5, -1, dtype=int)
      array([[0, 0, 0, 0, 0],
             [1, 0, 0, 0, 0],
             [1, 1, 0, 0, 0]])
  
      """
      if M is None:
          M = N
      if isinstance(M, string_types):
          # pearu: any objections to remove this feature?
          #       As tri(N,'d') is equivalent to tri(N,dtype='d')
          dtype = M
          M = N
      m = np.greater_equal.outer(np.arange(k, N + k), np.arange(M))
      if dtype is None:
          return m
      else:
          return m.astype(dtype)
  
imports: from __future__ import division, print_function, absolute_import
  import math
  import numpy
  from scipy._lib.six import xrange
  from scipy._lib.six import string_types
  from numpy.lib.stride_tricks import as_strided
label_desc: Use image node_id 1 for calling a global function with example usage: tri(N, M, k, dtype) and returns: m, m