def frag_remover(ack, load):
 global pkt_frag_loads
 while (len(pkt_frag_loads) > 50):
  pkt_frag_loads.popitem(last=False)
 copy_pkt_frag_loads = copy.deepcopy(pkt_frag_loads)
 for ip_port in copy_pkt_frag_loads:
  if (len(copy_pkt_frag_loads[ip_port]) > 0):
   while (len(copy_pkt_frag_loads[ip_port]) > 25):
    pkt_frag_loads[ip_port].popitem(last=False)
 copy_pkt_frag_loads = copy.deepcopy(pkt_frag_loads)
 for ip_port in copy_pkt_frag_loads:
  for ack in copy_pkt_frag_loads[ip_port]:
   if (len(copy_pkt_frag_loads[ip_port][ack]) > 5000):
    pkt_frag_loads[ip_port][ack] = pkt_frag_loads[ip_port][ack][(-200):]

def frag_remover ( ack , load ) : global pkt_frag_loads while ( len ( pkt_frag_loads ) > 50 ) : pkt_frag_loads . popitem ( last = False ) copy_pkt_frag_loads = copy . deepcopy ( pkt_frag_loads ) for ip_port in copy_pkt_frag_loads : if ( len ( copy_pkt_frag_loads [ ip_port ] ) > 0 ) : while ( len ( copy_pkt_frag_loads [ ip_port ] ) > 25 ) : pkt_frag_loads [ ip_port ] . popitem ( last = False ) copy_pkt_frag_loads = copy . deepcopy ( pkt_frag_loads ) for ip_port in copy_pkt_frag_loads : for ack in copy_pkt_frag_loads [ ip_port ] : if ( len ( copy_pkt_frag_loads [ ip_port ] [ ack ] ) > 5000 ) : pkt_frag_loads [ ip_port ] [ ack ] = pkt_frag_loads [ ip_port ] [ ack ] [ ( - 200 ) : ]
keep the filo ordereddict of frag loads from getting too large 3 points of limit: number of ip_ports < 50 number of acks per ip:port < 25 number of chars in load < 5000 .