Python: Apply suggestions from code review
Python: Apply suggestions from code review

Co-authored-by: yoff <b6e454fbe6f3650e0c1b6fb0c48b99a1f2efaac2@gmail.com>
github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql