This assumes the boundary between Python and the native code is clean and rarely crossed.