I learned a little python for making an app engine app, but i think I can help you.
keyerror means that that key doesn't exists in a list or an array.
if you are using lists the use hasattr(list, 'keyname').
can I ask what are you trying to do? add a new key to an array? or what?