Adding python3+ compatibility and tests