def tcp_traceflow(packet, timestamp, *, data_link, 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>protocol=data_link,                                         <EOL>index=count,                                                <EOL>frame=packet2dict(packet, timestamp, data_link=data_link),  <EOL>syn=bool(int(flags[<NUM_LIT:6>])),                                    <EOL>fin=bool(int(flags[<NUM_LIT:7>])),                                    <EOL>src=ipaddress.ip_address(ip.src),                           <EOL>dst=ipaddress.ip_address(ip.dst),                           <EOL>srcport=tcp.sport,                                          <EOL>dstport=tcp.dport,                                          <EOL>timestamp=timestamp,                                        <EOL>)<EOL>return True, data<EOL><DEDENT>return False, None<EOL>
Trace packet flow for TCP.