'Encode this Name into the appropriate byte format.
@type strio: file
@param strio: The byte representation of this Name will be written to
this file.
@type compDict: dict
@param compDict: dictionary of Names that have already been encoded
and whose addresses may be backreferenced by this Name (for the purpose
of reducing the message size).'

def encode(self, strio, compDict=None):

    name = self.name
    while name:
        if (compDict is not None):
            if (name in compDict):
                strio.write(struct.pack('!H', (49152 | compDict[name])))
                return
            else:
                compDict[name] = (strio.tell() + Message.headerSize)
        ind = name.find('.')
        if (ind > 0):
            (label, name) = (name[:ind], name[(ind + 1):])
        else:
            label = name
            name = None
            ind = len(label)
        strio.write(_ord2bytes(ind))
        strio.write(label)
    strio.write('\x00')
