OK. In general there are a ton of pylint issues in this file from before my changes. I'll take a quick pass through some of them but not sure I'll get them all in this commit.