def humanize_delay(delay):
    '''
    Accept a floating point number presenting link propagation delay
    in seconds (e.g., 0.1 for 100 milliseconds delay), and return
    a human(-like) string like '100 milliseconds'.  Handles values as 
    small as 1 microsecond, but no smaller.

    Because of imprecision in floating point numbers, a relatively easy
    way to handle this is to convert to string, then slice out sections.
    '''
    delaystr = '{:1.06f}'.format(delay) 
    decimal = delaystr.find('.') 
    seconds = int(delaystr[:decimal])
    millis = int(delaystr[-6:-3])
    micros = int(delaystr[-3:])
    # print (delay,delaystr,seconds,millis,micros)
    units = ''
    microsecs = micros + 1e3 * millis + 1e6 * seconds
    if micros > 0:
        units = ' \u00B5sec'
        value = int(microsecs)
    elif millis > 0:
        units = ' msec'
        value = int(microsecs / 1000)
    elif seconds > 0:
        units = ' sec'
        value = int(microsecs / 1000000)
    else:
        units = ' sec'
        value = delay
    if value > 1:
        units += 's'
    return '{}{}'.format(value, units)
Accept a floating point number presenting link propagation delay
    in seconds (e.g., 0.1 for 100 milliseconds delay), and return
    a human(-like) string like '100 milliseconds'.  Handles values as 
    small as 1 microsecond, but no smaller.

    Because of imprecision in floating point numbers, a relatively easy
    way to handle this is to convert to string, then slice out sections.