[apiexamples] Fix compatibility with Python3