'Writes a record (answer, authoritative answer, additional) to
the packet'

def writeRecord(self, record, now):

    self.writeName(record.name)
    self.writeShort(record.type)
    if (record.unique and self.multicast):
        self.writeShort((record.clazz | _CLASS_UNIQUE))
    else:
        self.writeShort(record.clazz)
    if (now == 0):
        self.writeInt(record.ttl)
    else:
        self.writeInt(record.getRemainingTTL(now))
    index = len(self.data)
    self.size += 2
    record.write(self)
    self.size -= 2
    length = len(''.join(self.data[index:]))
    self.insertShort(index, length)
