Outsource inner brief loop into cython file