code: def updown_linear_approx(eigvals_lower, eigvals_upper, nv):
      
      nal = len(eigvals_lower)
      nau = len(eigvals_upper)
      if nv < nal + nau:
          raise ValueError('Number of supplied eigenvalues ({0} lower and {1} upper) is higher than number of nodes ({2})!'.format(nal, nau, nv))
      ret = np.zeros(nv)
      ret[:nal] = eigvals_lower
      ret[-nau:] = eigvals_upper
      ret[nal-1:-nau+1] = np.linspace(eigvals_lower[-1], eigvals_upper[0], nv-nal-nau+2)
      return ret
docs: Approximates Laplacian spectrum using upper and lower parts of the eigenspectrum.
      
      Parameters
      ----------
      eigvals_lower : numpy.ndarray
          Lower part of the spectrum, sorted
      eigvals_upper : numpy.ndarray
          Upper part of the spectrum, sorted
      nv : int
          Total number of nodes (eigenvalues) in the graph.
  
      Returns
      -------
      numpy.ndarray
          Vector of approximated eigenvalues
  
      Examples
      --------
      >>> updown_linear_approx([1, 2, 3], [7, 8, 9], 9)
      array([1,  2,  3,  4,  5,  6,  7,  8,  9])