def save(self, overwrite=True):
    default = deepcopy(self.default)
    default[self.__class__.pk] = [self.pk]
    for (k, v) in default.items():
        if (k not in self.data):
            self.data[k] = v
    for (k, v) in self.presave.items():
        if callable(v):
            result = v(self, self.data.get(k, None))
            if (result is not None):
                self.data[k] = result
    for (k, v) in self.data.items():
        if (not isinstance(v, list)):
            v = [v]
        self.data[k] = v
        if ((v[0] is DEFAULT_NO_KEY) or isinstance(v[0], DEFAULT_NO_KEY)):
            del self.data[k]
    if ((not overwrite) and (self.pk in self.__class__.objects)):
        msg = 'error creating a LDAP directory entry: Already exists'
        raise RuntimeError(msg)
    self.__class__.objects[self.pk] = self
def save(self, overwrite=True):
    default = deepcopy(self.default)
    default[self.__class__.pk] = [self.pk]
    for (k, v) in default.items():
        if (k not in self.data):
            self.data[k] = v
    for (k, v) in self.presave.items():
        if callable(v):
            result = v(self, self.data.get(k, None))
            if (result is not None):
                self.data[k] = result
    for (k, v) in self.data.items():
        if (not isinstance(v, list)):
            v = [v]
        self.data[k] = v
        if ((v[0] is DEFAULT_NO_KEY) or isinstance(v[0], DEFAULT_NO_KEY)):
            del self.data[k]
    if ((not overwrite) and (self.pk in self.__class__.objects)):
        msg = 'error creating a LDAP directory entry: Already exists'
        raise RuntimeError(msg)
    self.__class__.objects[self.pk] = self