restructuring python extension