Restore Python 3 compatibility; JP2 parser tweaks