py: Move global/nonlocal decl code to compiler for proper SyntaxError.

This patch gives proper SyntaxError exceptions for bad global/nonlocal
declarations.  It also reduces code size: 304 bytes on unix x64, 132
bytes on stmhal.