Remove unused code
Redundant type conversion
Use ast.literal_eval rather than plain eval
Avoid directly using magic attribute names
Convert “print” and “exec” to functions

Inspired by using the “2to3” tool.
Substitute sys.stdout assignments for print-to-file function

Output file can be specified since Python 2.0.
Python 3 exception syntax; less dependence on “sys” module exception info

* New “except . . . as <var>” syntax introduced in Python 2.6
* Use plain "raise" statement to re-raise original exception
* Use Python 3’s “raise from” exception chaining to continue another
  exception
* Avoid saving traceback in local variables reachable from the traceback

Inspired using “2to3”.
Translate download using Latin-1 in the CLI printing tool

Explicitly return the final URL because TextIOWrapper does not wrap the “url”
attribute.
Write Post Script printer output with Latin-1 encoding