<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def addfield(self, pkt, s, val):
 """ Reconstruct the header because the TLS type may have been updated. Then, append the content. """

        res = b""
        for p in val:
            res += self.i2m(pkt, p)
        if (isinstance(pkt, _GenericTLSSessionInheritance) and
            _tls_version_check(pkt.tls_session.tls_version, 0x0304) and
                not isinstance(pkt, TLS13ServerHello)):
            return s + res
        if not pkt.type:
            pkt.type = 0
        hdr = struct.pack("!B", pkt.type) + s[1:5]
        return hdr + res