code: def max_cation_insertion(self):
          
  
          # how much 'spare charge' is left in the redox metals for reduction?
          lowest_oxid = defaultdict(lambda: 2, {'Cu': 1})  # only Cu can go down to 1+
          oxid_pot = sum([(spec.oxi_state - min(
              e for e in Element(spec.symbol).oxidation_states if e >= lowest_oxid[spec.symbol])) *
              self.comp[spec] for spec in self.comp if
              is_redox_active_intercalation(Element(spec.symbol))])
  
          return oxid_pot / self.cation_charge
docs: Maximum number of cation A that can be inserted while maintaining charge-balance.
          No consideration is given to whether there (geometrically speaking) are Li sites to actually accommodate the extra Li.
  
          Returns:
              integer amount of cation. Depends on cell size (this is an 'extrinsic' function!)