Add support for py3k (with backward compatibility)