made pwgen work in both python2 and 3