Make python script v3 compatible

Closes #1709
Pull request reviewed by @neumino and @atnnn

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Additional python change

Review 1069 by @neumino
Merge 1709 int v1.11.x
Draft NOTES for 1.11.2