docs: def _get_bandgap_from_bands(energies, nelec):
          """Compute difference in conduction band min and valence band max"""
          nelec = int(nelec)
          valence = [x[nelec-1] for x in energies]
          conduction = [x[nelec] for x in energies]
          return max(min(conduction) - max(valence), 0.0)