'Set key to value and add the key to the internal keys list if
missing.'

def _set(self, key, value):

    if ((value is None) and (getattr(self, key, None) is None)):
        return
    if isinstance(value, str):
        value = str_to_unicode(value)
    setattr(self, key, value)
    if (not (key in self._keys)):
        self._keys.append(key)
