Adding support for the six library

This change adds support for the six library, specifically for handling
portions of the code that are sensitive to differences between Python
2.* and 3.*.