Correct declaration for scope_key.

@nedbat @cpennington Previously, this code was: 

1) Missing the field name. 
2) Gave relatively unclean keys. 

This PR fixes both issue. 

Rapid review would be appreciated, since we're about to start prototyping things on prod which rely on this. If we can get this out, it will save us a migration later. 
To me, having the algorithm which generates them together with the definition is much more clear than just the output of the algorithm. I guess I could swap the two (algorithm in comment), but this is actually a bit more useful to me if I ever want to work with the code again. If I e.g. wanted to modify the code to escape all of ASCII as 4-character sequences, I'd just do the product four times, and put in all of ASCII minus A-Za-z0-9 in the substitutions. If I have the list, I need to rerun code or swap things around in code output. As a matter of style, although it matters not too much here, I generally find more functional code (less stored state, just-in-time computation) less error-prone. 

I'd swap it if there were a performance issue, or abstract into a global variable computed once, but it's 9 items. It's basically instant -- the algorithm runs in 4.7 microseconds on my machine. I thought the benefits to both readability and scoping of proximity outweighed the performance hit.