Impurity-capturing polymers: regulating chemistry and stability in lithium-ion batteries