code: def sbm(n_blocks, block_size, p, q, rng=None):
      """(Symmetric) Stochastic Block Model
  
      Parameters
      ----------
      n_blocks : int
          Number of blocks.
      block_size : int
          Block size.
      p : float
          Probability for intra-community edge.
      q : float
          Probability for inter-community edge.
      rng : numpy.random.RandomState, optional
          Random number generator.
  
      Returns
      -------
      scipy sparse matrix
          The adjacency matrix of generated graph.
      """
      n = n_blocks * block_size
      p /= n
      q /= n
      rng = np.random.RandomState() if rng is None else rng
  
      rows = []
      cols = []
      for i in range(n_blocks):
          for j in range(i, n_blocks):
              density = p if i == j else q
              block = sp.sparse.random(
                  block_size,
                  block_size,
                  density,
                  random_state=rng,
                  data_rvs=lambda n: np.ones(n),
              )
              rows.append(block.row + i * block_size)
              cols.append(block.col + j * block_size)
  
      rows = np.hstack(rows)
      cols = np.hstack(cols)
      a = sp.sparse.coo_matrix(
          (np.ones(rows.shape[0]), (rows, cols)), shape=(n, n)
      )
      adj = sp.sparse.triu(a) + sp.sparse.triu(a, 1).transpose()
      return adj
  
imports: import math
  import os
  import random
  import numpy
  import numpy.random
  import scipy
  from ..None import batch
  from ..convert import from_scipy
  from .dgl_dataset import DGLDataset
  from .utils import load_graphs, load_info, save_graphs, save_info
label_desc: Use image node_id 1 for calling a global function with example usage: sbm(n_blocks, block_size, p, q, rng) and returns: adj