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

Co-authored-by: Rasmus Wriedt Larsen <6dfdada9c346ecb5eceda0aac2a0eed555506730@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