def s2h(ss):
    """convert seconds to a pretty "d hh:mm:ss.s" format"""
    mm, ss = divmod(ss, 60)
    hh, mm = divmod(mm, 60)
    dd, hh = divmod(hh, 24)
    tstr = '%02i:%04.1f' % (mm, ss)
    if hh > 0:
        tstr = '%02i:' % hh + tstr
    if dd > 0:
        tstr = '%id ' % dd + tstr
    return tstr
