tests: Port gen-casefold-txt.pl and gen-casemap-txt.pl to Python 3. See #1332

I've tried to keep the code structure roughly the same.
8 jobs for tests-remove-perl in 21 minutes and 26 seconds (queued for 2 seconds)
latest