def _format_td(timedelt):
    """Format a timedelta object as hh:mm:ss"""
    if timedelt is None:
        return ''
    s = int(round(timedelt.total_seconds()))
    hours = s // 3600
    minutes = (s % 3600) // 60
    seconds = (s % 60)
    return '{:02d}:{:02d}:{:02d}'.format(hours, minutes, seconds)