def secs_as_string(secs):
    """Convert a number of seconds to dh'", eg

    25 => 25"
    190 => 3'10"
    6800 => 1h53'20"
    440000 => 5d2h13'20"
    345600 => 4d
    """
    d = timedelta(seconds=secs)
    days = d.days
    minutes, seconds = divmod(d.seconds, 60)
    hours, minutes = divmod(minutes, 60)
    return "".join([
        "%dd" % days if days else "",
        "%dh" % hours if hours else "",
        "%d'" % minutes if minutes else "",
        '%d"' % seconds if seconds else ""
    ])
dataset/ETHPy150Open tjguk/winsys/winsys/utils.py/secs_as_string/original