def __getitem__(self, key: str):
    '''
    Autogenerated code
    '''
    {%- for field in frozenset(chain(fields, properties)) %}
    {%if not loop.first%}el{%endif%}if key == '{{field}}':
        {{get_variable_template|format(key=field)|indent(8)}}
        return
    {%- endfor %}
    raise KeyError(key)

def __setitem__(self, key: str, val) -> None:
    '''
    Autogenerated code
    '''
    {%- for field in frozenset(chain(fields, properties)) %}
    {%if not loop.first%}el{%endif%}if key == '{{field}}':
        self.{{field}} = val
        return
    {%- endfor %}
    raise KeyError(key)
