Just "outsource" the loop to a separate Cython file `_brief_cy.pyx` and keep the public function interface in pure Python.