Modularized python code for drivers and modes