code: def _get_adjacency_sparse(self, attribute=None):
      """Returns the adjacency matrix of a graph as a SciPy CSR matrix.
  
      @param attribute: if C{None}, returns the ordinary adjacency
        matrix. When the name of a valid edge attribute is given
        here, the matrix returned will contain the default value
        at the places where there is no edge or the value of the
        given attribute where there is an edge.
      @return: the adjacency matrix as a C{scipy.sparse.csr_matrix}.
      """
      try:
          from scipy import sparse
      except ImportError:
          raise ImportError(
              "You should install scipy in order to use this function"
          ) from None
  
      edges = self.get_edgelist()
      if attribute is None:
          weights = [1] * len(edges)
      else:
          if attribute not in self.es.attribute_names():
              raise ValueError("Attribute does not exist")
  
          weights = self.es[attribute]
  
      N = self.vcount()
      mtx = sparse.csr_matrix(
          (weights, list(zip(*edges))), shape=(N, N)
      )
  
      if not self.is_directed():
          mtx = mtx + sparse.triu(mtx, 1).T + sparse.tril(mtx, -1).T
      return mtx
  
imports: from igraph._igraph import GET_ADJACENCY_BOTH, GET_ADJACENCY_LOWER, GET_ADJACENCY_UPPER, GraphBase
  from igraph.datatypes import Matrix
label_desc: Use image node_id 2 for calling a global function with example usage: _get_adjacency_sparse(attribute) and returns: mtx