Every municipal court, district court, juvenile court, superior court, and every other court handling traffic cases within the limits of a county wherein a traffic school has been established may, as a part of any sentence imposed following a conviction for any traffic law violation, or as a condition on the suspension of sentence or deferral of any imposition of sentence, order any person so convicted, whether that person be a juvenile, a minor, or an adult, to attend the traffic school for a number of days to be determined by the court, but not to exceed the maximum number of days which the violator could be required to serve in the city or county jail as a result of his or her conviction.