Initial support for 3.12. Keep compatible with 3.10.

I've tested it in 3.12.
I tried to keep compatible with 3.10, but didn't test it yet. So it may be buggy in 3.10.