Yay!
On the porting front, you'll need to decide how many old versions of calibre you're trying to support. The popular
six.py library is pretty available in calibre, since it's a dependency of dateutil and thus calibre has always (indirectly) used it:
calibre 1.48.0 -- 2.15.0: six 1.4.1
calibre 2.16.0 -- 2.85.0: six 1.7.2
calibre 3.0.0 -- current: six 1.10.0
A Kovid said, the polyglot module, internal to calibre, provides some compat layers as well, starting with calibre 3.32 you have:
Code:
from polyglot.builtins import is_py3, reraise, zip, map, filter, iteritems, iterkeys, itervalues
from polyglot.urllib import urlopen, urlencode
And lots more with later versions (primarily 3.41 and on), we can help you figure out what versions have what (if you need it).
Some previous discussion has occurred on the topic:
Python 2 to Python 3, Polyglot & Plugins
Python 3, Polyglot & @six.wraps