code: def valence(self):
          
          # the number of valence of noble gas is 0
          if self.group == 18:
              return (np.nan, 0)
  
          L_symbols = 'SPDFGHIKLMNOQRTUVWXYZ'
          valence = []
          full_electron_config = self.full_electronic_structure
          for _, l_symbol, ne in full_electron_config[::-1]:
              l = L_symbols.lower().index(l_symbol)
              if ne < (2 * l + 1) * 2:
                  valence.append((l, ne))
          if len(valence) > 1:
              raise ValueError("Ambiguous valence")
  
          return valence[0]
docs: # From full electron config obtain valence subshell
          # angular moment (L) and number of valence e- (v_e)