def format_timedelta(tdelta):
    """Return the timedelta as a 'HH:mm:ss' string."""
    total_seconds = int(tdelta.total_seconds())
    hours, remainder = divmod(total_seconds, 60*60)
    minutes, seconds = divmod(remainder, 60)
    return "{0:02d}:{1:02d}:{2:02d}".format(hours, minutes, seconds)