cmpe.py: Support Python 3.x

Only a few simple changes are required to support Python 3.x.
Since this script is fairly simple, I'm opting to support both
Python 2.7+ and 3.x in the same file (without using 2to3).

Signed-off-by: Nate Case <nacase@gmail.com>