'Takes an integer time in seconds, transforms it into
(HH:)?MM:SS. HH portion is only visible if total time is greater
than an hour.'

def to_minutes_seconds(self, stime):

    if (type(stime) != int):
        stime = int(stime)
    mm = (stime // 60)
    ss = (stime % 60)
    if (mm >= 60):
        hh = (mm // 60)
        mm = (mm % 60)
        rv = '{}:{:02}:{:02}'.format(hh, mm, ss)
    else:
        rv = '{}:{:02}'.format(mm, ss)
    return rv
