Implement it as a Python extension module.

It's 200~300 times faster than the old pure Python module implemention.