def ftime_ns(nanoseconds, precision=2, spaced=None):
    """
    Convert nanoseconds into a human-readable format (small units).
    """

    # shorten the variable name to keep line length under 100 lol
    ns = nanoseconds
    if ns < 1000:
        if spaced is True or spaced is None:
            return "{ns:.{precision}f} ns".format(ns=ns, precision=precision)
        return "{ns:.{precision}f}ns".format(ns=ns, precision=precision)

    elif ns < 1000000:
        if spaced is True or spaced is None:
            return "{ns:.{precision}f} \u00b5s".format(ns=ns / 1000, precision=precision)
        return "{ns:.{precision}f}\u00b5s".format(ns=ns / 1000, precision=precision)

    elif ns < 1000000000:
        if spaced is True or spaced is None:
            return "{ns:.{precision}f} ms".format(ns=ns / 1000000, precision=precision)
        return "{ns:.{precision}f}ms".format(ns=ns / 1000000, precision=precision)

    if spaced is True or spaced is None:
        return "{ns:.{precision}f} s".format(ns=ns / 1000000000, precision=precision)
    return "{ns:.{precision}f}s".format(ns=ns / 1000000000, precision=precision)