These are simple methods for dealing with Python 2/3 compatibility issues. They are focused on solving the problems of python 2/3 support in the dhp package. If you need more see six


return the proper iteritems method for a dictionary based on the version of Python


return proper iteritems method

Parameters:dct – dictionary
Return type:iterable method
from dhp.VI import iteritems

for k, val in iteritems(my_dict):
    do_something(k, val)

Use case: supporting python2 code that uses iteritems when targeting both 2 and 3.


is set to the major version of python currently running. Either 2 or 3 respectively.


Imports the correct StringIO for the currently running version of Python.

from dhp.VI import StringIO