Review this Python function that prunes archived items from an in-memory list. Profiling shows it dominates a nightly job when the list has hundreds of thousands of items.