The metal–insulator transition in trivalent-ion-doped tungsten bronzes