Python: Don't issue Unused Variable warning when using locals() in current scope

Port of [commit 947e988](https://github.com/iElectric/pyflakes/commit/947e988b3548d360e46ffc996eb4671fa875ca11) in [pyflakes](https://github.com/kevinw/pyflakes) so we don't have to wait until 0.4.1 gets released.

Reference: [pull request #25](https://github.com/kevinw/pyflakes/pull/25) in pyflakes repo