'Prevents invalid keys from being set.'

def __setitem__(self, key, val):

    if (key in self._valid_keys):
        return dict.__setitem__(self, key, val)
    else:
        raise KeyError((self._invalid_key % key))
