Formatting time delta
There is indeed a function for that.

&gt;&gt;&gt; from datetime import timedelta 
&gt;&gt;&gt; print(timedelta(seconds=1239.123456))
0:20:39.123456


Now, if I understand you correctly, you want a divider for the millisecond.

from datetime import timedelta 
def f(secs):
    t=str(timedelta(seconds=secs))
    index = t.find('.') + 4
    return t[:index] + ' ' + t[index:]
print(f(1239.123456))
# 0:20:39.123 456


I don't like that everything is hardcoded, if you want to use it for different applications (or even languages), you might want to generalize your bases and names. 

Here is a generic way of doing any formatting you want:

def prod(f):
    total = 1
    l = [1]
    for i in range(len(f)-1, 0, -1):
        total *= f[i][0]
        l.append(total)
    return reversed(l)


def format_time(number, f=((24, ':'), (60, ':'), (60, '.'), (1000, ' '), (1000, ''))):
    return ''.join(
        (f"{(number//div)%base:0&gt;{len(str(base-1))}}" + delimiter)
        if number//div else ''
        for div, (base, delimiter) in zip(prod(f), f)
    )


formatting = (
    (24, ' hours '),
    (60, ' minutes '),
    (60, ' seconds '),
    (1000, ' milliseconds '),
    (1000, ' nanoseconds'),
)

print(
    format_time(1551198373998173),
    format_time(1551198373998173, formatting),
    format_time(1551739, formatting),
    sep="\n"
)


The result is:

16:26:13.998 173
16 hours 26 minutes 13 seconds 998 milliseconds 173 nanoseconds
01 seconds 551 milliseconds 739 nanoseconds


What are it's advantages, you can do any formatting in any base, with any names. We could even do a base 2 converter.

binary_formatting = (((2, ' '),)+((2, ''),)*3)*10 + ((2, ''),)

print(
    format_time(155933900, binary_formatting),
    format_time(3279, binary_formatting),
    sep="\n"
)


1001 0100 1011 0101 1100 1100 1100
1100 1100 1111


Other than that, if your code need to accomplish a single purpose and it does it well, good for you.