switch to python for FSM