def format_time(seconds):
    """Formats seconds as an ISO time string `hh:mm:ss`."""
    minutes, seconds_rem = divmod(seconds, 60)
    if minutes >= 60:
        hours, minutes_rem = divmod(minutes, 60)
        return "%02d:%02d:%02d" % (hours, minutes_rem, seconds_rem)
    return "00:%02d:%02d" % (minutes, seconds_rem)