Add an internal value to a string

def addfield(self, pkt, s, val):
        """Add an internal value to a string"""
        if self.length_of(pkt) == 8:
            return s + struct.pack(self.fmt[0] + "B", val)
        if self.length_of(pkt) == 16:
            return s + struct.pack(self.fmt[0] + "H", val)
        if self.length_of(pkt) == 32:
            return s + struct.pack(self.fmt[0] + "2H", val)  # TODO: fix!
        if self.length_of(pkt) == 48:
            return s + struct.pack(self.fmt[0] + "3H", val)  # TODO: fix!
        elif self.length_of(pkt) == 64:
            return s + struct.pack(self.fmt[0] + "Q", val)
        elif self.length_of(pkt) == 128:
            # TODO: FIX THE PACKING!!
            return s + struct.pack(self.fmt[0] + "16s", raw(val))
        else:
            return s