Add backwards-compatible Python 3 support

Building on top of pull request #3 by @ekaakurniawan, these commits add Python 3 support while preserving Python 2.7 support.