Updated for python3 compliance.