allow_otp(log, phone, now) where log is a dict phone → list of prior timestamps: return True and record now when under the limit (counting only timestamps within 600 s), else False (unrecorded). Prune old entries as you go.allow_otp({'98x': [0, 100, 200]}, '98x', 300)False
Three sends already sit inside the window.
Filter the list to now - t < 600 first.
Append only on allow.