Replacing Python 3 depreciated cgi.escape
Adding api.py tests
Additional test pep8/pylint cleanup

Cleaning up the module itself could be a pain, but no reason not to keep the tests reasonably compliant