Implement a debouncing function from scratch
Asked in the coding stage. Implement trailing-edge debouncing using a deterministic event simulation rather than real timers.
Implement debounce(calls, wait, cancel_at). calls is a list of objects containing at, a nondecreasing timestamp, and args, a list of callback arguments. Each call replaces the previously pending call. Execute only the most recent call after wait time units without a newer call. If cancel_at is not null, cancel the pending call at that timestamp. Return the argument lists for callbacks that execute, in execution order. A cancellation does not prevent later calls from being scheduled.
def debounce(calls, wait, cancel_at):