Adapt example for Python3