How? No idea. From what I've learned the change can happen from any number of sources. Large amounts of any affinity of magic, certain magical plants, even large magical events like a volcano eruption, this snake could have been unique in some other way before this happened, or hell even some pony messing with something they shouldn't. I don't think I will ever know for sure what it did to become what it is now.