python scope rules can fool you