Issue #783: python3 compatible.
Restored a change lost during merge.