code: def eye(
      N: int,
      M: Optional[int] = None,
      k: int = 0,
      dtype: DTypeLike = float,
      order: _OrderCF = "C",
  ) -> NDArray[Any]:
      """Returns a 2-D array with ones on the diagonals and zeros elsewhere.
  
      Args:
          N (int): Number of rows.
          M (int): Number of columns. ``M == N`` by default.
          k (int): Index of the diagonal. Zero indicates the main diagonal,
              a positive index an upper diagonal, and a negative index a lower
              diagonal.
          dtype (data-type, optional): Data type specifier.
          order ({'C', 'F'}): Row-major (C-style) or column-major
              (Fortran-style) order.
  
      Returns:
          cupy.ndarray: A 2-D array with given diagonals filled with ones and
          zeros elsewhere.
  
      .. seealso:: :func:`numpy.eye`
  
      """
      if M is None:
          M = N
      ret = zeros((N, M), dtype=dtype, order=order)
      if k <= -N or k >= M:
          return ret
      ret.diagonal(k).fill(1)
      return ret
  
file_path: cupy/cupy/_creation/basic.py
imports: from typing import Any, Optional
  import numpy
  import cupy
  from cupy._core.internal import _get_strides_for_order_K, _update_order_char
  from cupy.typing._types import _OrderKACF, _OrderCF, _ShapeLike, DTypeLike, NDArray
label_desc: Use image node_id 4 for calling a global function with example usage: eye(N, M, k, dtype, order) and returns: ret, ret