def time2str(t):
    """Takes a value of time as a number of seconds and returns it in the form
"hh:mm:ss".
    
    Parameters
    ----------
    t : int
        Time in seconds.
    
    Returns
    -------
    s : str
        Time in the form "hh:mm:ss". Hours omitted if there are none.
    """
    
    hours = t // 3600
    min_sec = t % 3600
    
    mins = min_sec // 60
    sec = min_sec % 60
    
    if hours < 10 or hours != 0:
        hours = "0" + str(hours)
    else:
        hours = str(hours)
    if mins < 10:
        mins = "0" + str(mins)
    else:
        mins = str(mins)
    if sec < 10:
        sec = "0" + str(sec)
    else:
        sec = str(sec)
    if hours == "00":
        s = "" + mins + ":" + sec
    else:
        s = "" + hours + ":" + mins + ":" + sec

    return s