Refactoring of PYPOWER for Python 3. An older revision is used as the base for the refactoring, because newer revisions have failing tests.