in many cases this is a microprocessor controlled circuit - and considerable design and test expertise is needed to create a reliable, low cost yet effective ballast.
A lighting device needs to operate in AC circuits with voltages ranging from 108 to 270 volts and frequencies of 50-60 Hz.