For loop for mode=DoB in Cython