class FixedOrderedDict(MutableMapping):

    def __init__(self, *args):
        self._d = OrderedDict(*args)

def __getitem__(self, key):
    return self._d[key]

def __setitem__(self, key, value):
    if key not in self._d:
        raise KeyError('Must not add new keys')
self._d[key] = value

def __delitem__(self, key):
    raise NotImplementedError('Must not remove keys')

def __iter__(self):
    return iter(self._d)

def __len__(self):
    return len(self._d)
Mutable dictionary with fixed and ordered keys