'Set an attr with protection of class members.
This calls :meth:`self.__setitem__` but convert :exc:`KeyError` to
:exc:`AttributeError`.
Examples
>>> s = Struct()
>>> s.a = 10
>>> s.a
10
>>> try:
...     s.get = 10
... except AttributeError:
...     print("you can\'t set a class member")
you can\'t set a class member'

def __setattr__(self, key, value):

    if isinstance(key, str):
        if ((key in self.__dict__) or hasattr(Struct, key)):
            raise AttributeError(('attr    %s    is    a    protected    member    of    class    Struct.' % key))
    try:
        self.__setitem__(key, value)
    except KeyError as e:
        raise AttributeError(e)
