move common code in commonc.pyx