code: def identity(n, dtype="d", format=None):
      """Identity matrix in sparse format
  
      Returns an identity matrix with shape (n,n) using a given
      sparse format and dtype. This differs from `eye_array` in
      that it has a square shape with ones only on the main diagonal.
      It is thus the multiplicative identity. `eye_array` allows
      rectangular shapes and the diagonal can be offset from the main one.
  
      .. warning::
  
          This function returns a sparse matrix -- not a sparse array.
          You are encouraged to use ``eye_array`` to take advantage
          of the sparse array functionality.
  
      Parameters
      ----------
      n : int
          Shape of the identity matrix.
      dtype : dtype, optional
          Data type of the matrix
      format : str, optional
          Sparse format of the result, e.g., format="csr", etc.
  
      Examples
      --------
      >>> import scipy as sp
      >>> sp.sparse.identity(3).toarray()
      array([[ 1.,  0.,  0.],
             [ 0.,  1.,  0.],
             [ 0.,  0.,  1.]])
      >>> sp.sparse.identity(3, dtype='int8', format='dia')
      <3x3 sparse matrix of type '<class 'numpy.int8'>'
              with 3 stored elements (1 diagonals) in DIAgonal format>
      >>> sp.sparse.eye_array(3, dtype='int8', format='dia')
      <3x3 sparse array of type '<class 'numpy.int8'>'
              with 3 stored elements (1 diagonals) in DIAgonal format>
  
      """
      return eye(n, n, dtype=dtype, format=format)
  
imports: import numbers
  import math
  import numpy
  from scipy._lib._util import check_random_state, rng_integers
  from ._sputils import upcast, get_index_dtype, isscalarlike
  from ._sparsetools import csr_hstack
  from ._bsr import bsr_matrix, bsr_array
  from ._coo import coo_matrix, coo_array
  from ._csc import csc_matrix, csc_array
  from ._csr import csr_matrix, csr_array
  from ._dia import dia_matrix, dia_array
  from ._base import issparse, sparray
label_desc: Use image node_id 4 for calling a global function with example usage: identity(n, dtype, format) and returns: eye