Most recent Python 3 version of apev2.py