Improved some regular expressions (including trimming extra comma); made new test Python 2 & 3 compatible.