Working cython stateupdate with lots of restrictions and SLOW