def elapsed(seconds, short=True):
    """ return elapsed time in string form. """
    txt = ''
    nsec = float(seconds)
    year = 365 * 24 * 60 * 60
    week = 7 * 24 * 60 * 60
    nday = 24 * 60 * 60
    hour = 60 * 60
    minute = 60
    years = int(nsec / year)
    nsec -= years * year
    weeks = int(nsec / week)
    nsec -= weeks * week
    nrdays = int(nsec / nday)
    nsec -= nrdays * nday
    hours = int(nsec / hour)
    nsec -= hours * hour
    minutes = int(nsec / minute)
    sec = nsec - minutes * minute
    if years:
        txt += '%sy' % years
    if weeks:
        nrdays += weeks * 7
    if nrdays:
        txt += '%sd' % nrdays
    if years and short and txt:
        return txt
    if hours:
        txt += '%sh' % hours
    if nrdays and short and txt:
        return txt
    if minutes:
        txt += '%sm' % minutes
    if hours and short and txt:
        return txt
    if sec == 0:
        txt += '0s'
    elif sec < 1 or not short:
        txt += '%.3fs' % sec
    else:
        txt += '%ss' % int(sec)
    txt = txt.strip()
    return txt
