code: def spdiags(data, diags, m, n, format=None):
      """Creates a sparse matrix from diagonals.
  
      Args:
          data (cupy.ndarray): Matrix diagonals stored row-wise.
          diags (cupy.ndarray): Diagonals to set.
          m (int): Number of rows.
          n (int): Number of cols.
          format (str or None): Sparse format, e.g. ``format="csr"``.
  
      Returns:
          cupyx.scipy.sparse.spmatrix: Created sparse matrix.
  
      .. seealso:: :func:`scipy.sparse.spdiags`
  
      """
      return _dia.dia_matrix((data, diags), shape=(m, n)).asformat(
          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 3 for calling a global function with example usage: spdiags(data, diags, m, n, format) and returns: _dia