p3k compatibility

Added py3k compatibility.