Fix bug in pgen parser port from Basil.
Fix import order to prefer Python 2 StringIO, if available.