It would be better to write this part in python directly.
It would be better to write this part in python directly.