Given a stream of network packets, write a function to detect and flag potential duplicate transmissions within a specific sliding time window.
Packets arrive in nondecreasing timestamp order. Each packet is a dictionary containing timestamp, src_ip, dst_ip, protocol, and payload_hash; two packets match when all five fields except timestamp are equal. Return the zero-based indices of packets that match an earlier packet no more than window_seconds ago. Use def flag_duplicate_packets(packets, window_seconds):.
def flag_duplicate_packets(packets, window_seconds):