self current_task none def busy(self)if self current_task !nonereturn true elsereturn false def start_next(selfnew_task)self current_task new_task self time_remaining new_task get_pages( /self page_rate class taskdef __init__(selftime)self timestamp time self pages random randrange( def get_stamp(self)return self timestamp def get_pages(self)return self pages def wait_time(selfcurrent_time)return current_time self timestamp def simulation(num_secondspages_per_minute)lab_printer printer(pages_per_minuteprint_queue queue(waiting_times [for current_second in range(num_seconds)if new_print_task()task task(current_secondprint_queue enqueue(taskif (not lab_printer busy()and (not print_queue is_empty())next_task print_queue dequeue(waiting_times append(next_task wait_time(current_second)lab_printer startnext(next_tasklab_printer tick(average_wait sum(waiting_timeslen(waiting_timesprint("average wait % secs % tasks remaining %(average_waitprint_queue size())def new_print_task() basic data structures