def secs(value):
    units = ['s ', 'ms', 'us', 'ns']
    pos = 0

    if value == 0:
        return '  0.000ns'
    else:
        for unit in units:
            if value > 1:
                return '%7.3f' % value + unit
            else:
                value *= 1000
dataset/ETHPy150Open grantjenks/python-diskcache/tests/utils.py/secs/original