Python coding task. Implement prioritize(leads) using only t...
Prompt
Python coding task. Implement prioritize(leads) using only the standard library. Input is a list of dicts with id, status, price_requested and updated_at. A lead is eligible only when status is a string equal to ready after stripping whitespace and case-folding, and price_requested is the boolean True (not 1 or the string yes). Deduplicate IDs case-insensitively after trimming; keep only the latest ISO 8601 UTC timestamp per ID, even if that newest record is not eligible. If timestamps tie, keep the later input record. Return the original trimmed IDs for eligible winners sorted case-insensitively. Invalid or missing IDs/timestamps must raise ValueError. Do not mutate inputs. Return the complete function and minimal meaningful tests for eligibility, deduplication, ties, invalid data and non-mutation.