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
Status Job ID Name Coverage
  Build
passed #47047
fedora-meson-android_ndk_r16_api21_arm64

00:06:23

passed #47048
fedora-meson-mingw64

00:07:00

passed #47046
fedora-meson-x86_64

00:07:44

passed #52097
win32
msys2-mingw32

00:08:20

passed #52098
win32
vs2017-x64

00:06:30

passed #47049
win32
msys2-mingw32

00:07:34

passed #47050
win32
vs2017-x64

00:05:37

 
  Coverage
passed #47051
coverage

00:05:22

77.0%