code: def eye(m, n=None, k=0, dtype=float, format=None):
      """Sparse matrix with ones on diagonal
  
      Returns a sparse (m x n) matrix where the kth diagonal
      is all ones and everything else is zeros.
  
      Parameters
      ----------
      m : int
          Number of rows in the matrix.
      n : int, optional
          Number of columns. Default: `m`.
      k : int, optional
          Diagonal to place ones on. Default: 0 (main diagonal).
      dtype : dtype, optional
          Data type of the matrix.
      format : str, optional
          Sparse format of the result, e.g., format="csr", etc.
  
      Examples
      --------
      >>> from scipy import sparse
      >>> sparse.eye(3).toarray()
      array([[ 1.,  0.,  0.],
             [ 0.,  1.,  0.],
             [ 0.,  0.,  1.]])
      >>> sparse.eye(3, dtype=np.int8)
      <3x3 sparse matrix of type '<class 'numpy.int8'>'
          with 3 stored elements (1 diagonals) in DIAgonal format>
  
      """
      if n is None:
          n = m
      m, n = int(m), int(n)
  
      if m == n and k == 0:
          # fast branch for special formats
          if format in ["csr", "csc"]:
              idx_dtype = get_index_dtype(maxval=n)
              indptr = np.arange(n + 1, dtype=idx_dtype)
              indices = np.arange(n, dtype=idx_dtype)
              data = np.ones(n, dtype=dtype)
              cls = {"csr": csr_matrix, "csc": csc_matrix}[format]
              return cls((data, indices, indptr), (n, n))
          elif format == "coo":
              idx_dtype = get_index_dtype(maxval=n)
              row = np.arange(n, dtype=idx_dtype)
              col = np.arange(n, dtype=idx_dtype)
              data = np.ones(n, dtype=dtype)
              return coo_matrix((data, (row, col)), (n, n))
  
      diags = np.ones((1, max(0, min(m + k, n))), dtype=dtype)
      return spdiags(diags, k, m, n).asformat(format)
  
imports: import numbers
  from functools import partial
  import numpy
  from scipy._lib._util import check_random_state, rng_integers
  from .sputils import upcast, get_index_dtype, isscalarlike
  from .csr import csr_matrix
  from .csc import csc_matrix
  from .bsr import bsr_matrix
  from .coo import coo_matrix
  from .dia import dia_matrix
  from .base import issparse
label_desc: Use image node_id 4 for calling a global function with example usage: eye(m, n, k, dtype, format) and returns: spdiags, cls, coo_matrix