def ms_format(milliseconds:float) -> str:
    """Slightly smart formating of an elapsed time
    """
    assert milliseconds >= 0
    if milliseconds < 1:
        return f"{milliseconds:.3f}ms"
    if milliseconds < 1000:
        return f"{milliseconds:.2f}ms"
    return f"{(milliseconds/1000):.3f}sec"