While working on !4021 (merged) I spot a bit of Python code from !4062 (merged) that can be improved.