def tcp_reassembly(packet, *, count=NotImplemented):
if getattr(packet, '<STR_LIT>', None):<EOL><INDENT>ip = packet['<STR_LIT>']<EOL><DEDENT>elif getattr(packet, '<STR_LIT>', None):<EOL><INDENT>ip = packet['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>return False, None<EOL><DEDENT>tcp = getattr(ip, '<STR_LIT>', None)<EOL>if tcp is not None:<EOL><INDENT>flags = bin(tcp.flags)[<NUM_LIT:2>:].zfill(<NUM_LIT:8>)<EOL>data = dict(<EOL>bufid=(<EOL>ipaddress.ip_address(ip.src),                   <EOL>ipaddress.ip_address(ip.dst),                   <EOL>tcp.sport,                                      <EOL>tcp.dport,                                      <EOL>),<EOL>num=count,                                          <EOL>ack=tcp.ack,                                        <EOL>dsn=tcp.seq,                                        <EOL>rst=bool(int(flags[<NUM_LIT:5>])),                            <EOL>syn=bool(int(flags[<NUM_LIT:6>])),                            <EOL>fin=bool(int(flags[<NUM_LIT:7>])),                            <EOL>payload=bytearray(tcp.pack()[tcp.__hdr_len__:]),    <EOL>)<EOL>raw_len = len(tcp.data)                                 <EOL>data['<STR_LIT>'] = tcp.seq                                 <EOL>data['<STR_LIT>'] = tcp.seq + raw_len                        <EOL>data['<STR_LIT>'] = raw_len                                   <EOL>return True, data<EOL><DEDENT>return False, None<EOL>
Make data for TCP reassembly.