1. A system mounted in a vehicle, the system for classifying a light source, the system comprising: a spatial image sensor; a lens that is adapted to provide an image of a light source on said spatial image sensor; a diffraction grating disposed between said lens and said light source, said diffraction grating adapted to provide a spectrum; and a processor configured to classify said light source as belonging to a class selected from a plurality of classes of light sources expected to be found in a vicinity of the vehicle, said processor using said spectrum to classify said light source.