Headway needs to recommend an available appointment window near a member's preferred start time. Given available appointment intervals, a requested appointment duration, and a preferred start time, return the best interval that can contain the appointment.
An interval is represented as [start, end], where both values are integer minutes from the beginning of the day and start < end. An interval is feasible when end - start >= duration.
Rank feasible intervals using these rules, in order:
start and preferred_start.end - start.start.Return the original interval as [start, end]. Return [] if no interval can fit the requested duration.
def choose_appointment_slot(slots, duration, preferred_start):