code: def eye(
      N: int,
      M: int | None = None,
      k: int = 0,
      dtype: DTypeLike | None = None,
      index_dtype: DTypeLike = "int32",
      sparse_format: str = "bcoo",
      **kwds,
  ) -> JAXSparse:
      """Create 2D sparse identity matrix.
  
      Args:
        N: int. Number of rows in the output.
        M: int, optional. Number of columns in the output. If None, defaults to `N`.
        k: int, optional. Index of the diagonal: 0 (the default) refers to the main
           diagonal, a positive value refers to an upper diagonal, and a negative value
           to a lower diagonal.
        dtype: data-type, optional. Data-type of the returned array.
        index_dtype: (optional) dtype of the index arrays.
        format: string specifying the matrix format (e.g. ['bcoo']).
        **kwds: additional keywords passed to the format-specific _empty constructor.
  
      Returns:
        I: two-dimensional sparse matrix with ones along the k-th diagonal.
      """
      formats = {"bcoo": BCOO, "coo": COO, "csr": CSR, "csc": CSC}
      if M is None:
          M = N
      N = core.concrete_or_error(operator.index, N)
      M = core.concrete_or_error(operator.index, M)
      k = core.concrete_or_error(operator.index, k)
  
      cls = formats[sparse_format]
      return cls._eye(
          M=M, N=N, k=k, dtype=dtype, index_dtype=index_dtype, **kwds
      )
  
imports: from __future__ import annotations
  from functools import partial
  import operator
  from typing import Optional, Union
  import jax
  from jax import tree_util
  from jax.experimental.sparse._base import JAXSparse
  from jax.experimental.sparse.bcoo import BCOO
  from jax.experimental.sparse.bcsr import BCSR
  from jax.experimental.sparse.coo import COO
  from jax.experimental.sparse.csr import CSR, CSC
  from jax.experimental.sparse.util import _coo_extract
  from jax.interpreters import mlir
  from jax._src import core
  from jax._src import dtypes
  from jax._src.interpreters import ad
  from jax._src.interpreters import batching
  from jax._src.typing import Array, DTypeLike, Shape
label_desc: Use image node_id 8 for calling a global function with example usage: eye(N, M, k, dtype, index_dtype, sparse_format) and returns: cls