code: def tcp_reassembly(frame):
      
      if 'TCP' in frame:
          ip = (frame['IPv4'] if 'IPv4' in frame else frame['IPv6']).info
          tcp = frame['TCP'].info
          data = dict(
              bufid=(
                  ip.src,                                     # source IP address
                  ip.dst,                                     # destination IP address
                  tcp.srcport,                                # source port
                  tcp.dstport,                                # destination port
              ),
              num=frame.info.number,                          # original packet range number
              ack=tcp.ack,                                    # acknowledgement
              dsn=tcp.seq,                                    # data sequence number
              syn=tcp.flags.syn,                              # synchronise flag
              fin=tcp.flags.fin,                              # finish flag
              rst=tcp.flags.rst,                              # reset connection flag
              payload=bytearray(tcp.packet.payload or b''),   # raw bytearray type payload
          )
          raw_len = len(data['payload'])                      # payload length, header excludes
          data['first'] = tcp.seq                             # this sequence number
          data['last'] = tcp.seq + raw_len                    # next (wanted) sequence number
          data['len'] = raw_len                               # payload length, header excludes
          return True, data
      return False, None
docs: Make data for TCP reassembly.