code: def trilu(
      x: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      k: int = 0,
      upper: bool = True,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """
      Return the upper or lower triangular part of a matrix
      (or a stack of matrices) ``x``.
       note::
          The upper triangular part of the matrix is defined as the elements
          on and above the specified diagonal ``k``. The lower triangular part
          of the matrix is defined as the elements on and below the specified
          diagonal ``k``.
  
      Parameters
      ----------
      x
          input array having shape (..., M, N) and whose innermost two dimensions form MxN
          matrices.    *,
      k
          diagonal below or above which to zero elements. If k = 0, the diagonal is the
          main diagonal. If k < 0, the diagonal is below the main diagonal. If k > 0, the
          diagonal is above the main diagonal. Default: ``0``.
      upper
          indicates whether upper or lower part of matrix is retained. Default: ``True``.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          an array containing the upper or lower triangular part(s). The returned array
          must have the same shape and data type as x. All elements below or above the
          specified diagonal k must be zeroed. The returned array should be allocated on
          the same device as x.
      Both the description and the type hints above assumes an array input for simplicity,
      but this function is *nestable*, and therefore also accepts :class:`ivy.Container`
      instances in place of any of the arguments.
      """
      return current_backend(x).trilu(x, k=k, upper=upper, out=out)
  
imports: from typing import Union, Tuple, Optional, Sequence, Iterable, Generator
  import warnings
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.utils.exceptions import handle_exceptions
  from ivy.func_wrapper import outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_out_argument, infer_dtype, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_backend_invalid, handle_array_function
label_desc: Use image node_id 21 for calling a global function with example usage: trilu() and returns: current_backend