code: def second_order_moments(adata, adjusted=False):
      
      if 'neighbors' not in adata.uns:
          raise ValueError('You need to run `pp.neighbors` first to compute a neighborhood graph.')
  
      connectivities = get_connectivities(adata)
      s, u = csr_matrix(adata.layers['spliced']), csr_matrix(adata.layers['unspliced'])
      Mss = csr_matrix.dot(connectivities, s.multiply(s)).astype(np.float32).A
      Mus = csr_matrix.dot(connectivities, s.multiply(u)).astype(np.float32).A
      if adjusted:
          Mss = 2 * Mss - adata.layers['Ms'].reshape(Mss.shape)
          Mus = 2 * Mus - adata.layers['Mu'].reshape(Mus.shape)
      return Mss, Mus
docs: Computes second order moments for stochastic velocity estimation.
  
      Arguments
      ---------
      adata: `AnnData`
          Annotated data matrix.
  
      Returns
      -------
      Mss: Second order moments for spliced abundances
      Mus: Second order moments for spliced with unspliced abundances