Misc py3 compatibility fixes.

This commit fixes some minor issues that arise when importing rdflib in a Py3 environment. Compatibility with at least Python 2.6 is verified.