from datetime import timedelta def human_timedelta(delta: timedelta) -> str: hours = delta.seconds // 3600 minutes = delta.seconds % (hours * 3600) // 60 return ( f"{delta.days} days, " if delta.days else "" ) + f"{hours:0>2}:{minutes:0>2}" # zero-pad to two digits