time_left(now, deadline) returning '<d>d <h>h <m>m' until the deadline (e.g. '2d 4h 30m'), or 'expired' if the deadline has passed. Break the timedelta down via its .days and .seconds attributes — remember .seconds excludes the days.time_left(dt(2026,1,1,0,0), dt(2026,1,3,4,30))
'2d 4h 30m'
The delta is 2 days plus 4.5 hours.
delta.seconds // 3600 gives hours within the day.
(delta.seconds % 3600) // 60 gives minutes.