def format_seconds(secs):
    if secs < 1e-3:
        t, u = secs * 1e6, 'microsec'
    elif secs < 1e0:
        t, u = secs * 1e3, 'millisec'
    else:
        t, u = secs, 'sec'
    return '{:.03f} {}'.format(t, u)
