Add or update a given DNS record

def add_record(self, record):
        """Add or update a given DNS record"""
        rec = self.get_record(record._record_type, record.host)
        if rec:
            rec = record
            for i,r in enumerate(self._entries):
                if r._record_type == record._record_type \
                        and r.host == record.host:
                            self._entries[i] = record
        else:
            self._entries.append(record)
        self.sort()
        return True