def __setattr__(self, key, value):
if self.field_attr_on and key in self.fields:<EOL><INDENT>tpl = '<STR_LIT>'<EOL>raise InvalidOperation(tpl % (self, key))<EOL><DEDENT>if key in self.__slots__ or key in self.__dict__:<EOL><INDENT>return super(Struct, self).__setattr__(key, value)<EOL><DEDENT>raise AttributeError("<STR_LIT>" %<EOL>(self.__class__.__name__, key))<EOL>
magic python method to control setting attributes on the object.

:param key:
:param value:
:return: