[all] Python3 compat fixes