Variable Scoping in Python Nightmares