Criteo's observability workflows may receive event records in arbitrary timestamp order. Implement a function that sorts the records by timestamp and efficiently returns every event whose timestamp falls within an inclusive range.
Each event is represented as a two-element list [timestamp, event_id], where timestamp is an integer and event_id is a string. Given a list of events, start_time, and end_time, return a two-element list:
start_time <= timestamp <= end_time, in sorted order.You may sort the input list in place. The range result may be empty.
def find_events_in_time_range(events, start_time, end_time):