A multiswitchable poly(terthiophene) bearing a spiropyran functionality: understanding photo- and electrochemical control.