Add python2 compatibility to PR #66