Migrate to Python 3.9
Change print statements to use parentheses, decode byte strings, replace deprecated cgi, and htmllib libraries.