infected_users = shelve.open('infected_users.dat')
for iteration in range(1, N):
    current_timestamp = timestamp_from_iteration(iteration)
current_clean_users = clean_user[current_timestamp]
current_infected_users = infected_user[current_timestamp]
new_infected_users = dict()
infected_users.close()
clean_users.close()
Отслеживание контактов в Python — работа с временными рядами