code: def identity(n, dtype="d", format=None):
      """Creates an identity matrix in sparse format.
  
      .. note::
         Currently it only supports csr, csc and coo formats.
  
      Args:
          n (int): Number of rows and columns.
          dtype: Type of a matrix to create.
          format (str or None): Format of the result, e.g. ``format="csr"``.
  
      Returns:
          cupyx.scipy.sparse.spmatrix: Created identity matrix.
  
      .. seealso:: :func:`scipy.sparse.identity`
  
      """
      return eye(n, n, dtype=dtype, format=format)
  
file_path: cupy/cupyx/scipy/sparse/_construct.py
imports: import numpy
  import cupy
  from cupyx.scipy.sparse import _coo
  from cupyx.scipy.sparse import _csc
  from cupyx.scipy.sparse import _csr
  from cupyx.scipy.sparse import _dia
  from cupyx.scipy.sparse import _sputils
label_desc: Use image node_id 2 for calling a global function with example usage: identity(n, dtype, format) and returns: eye