Python 3 port of https://bitbucket.org/htgoebel/python-ghostscript