'Set an item with check for allownew.
Examples
>>> s = Struct()
>>> s[\'a\'] = 10
>>> s.allow_new_attr(False)
>>> s[\'a\'] = 10
>>> s[\'a\']
10
>>> try:
...     s[\'b\'] = 20
... except KeyError:
...     print(\'this is not allowed\')
this is not allowed'

def __setitem__(self, key, value):

    if ((not self._allownew) and (key not in self)):
        raise KeyError(("can't    create    new    attribute    %s    when    allow_new_attr(False)" % key))
    dict.__setitem__(self, key, value)
