• Sort by Extension

Question related to mission Sort by Extension

 
def sort_by_ext(files: list[str]) -> list[str]:
    # your code here
    return sorted(files, key=sort_key)

def sort_key(file) -> tuple[str, str]:
    name, dot, ext = file.rpartition(".")
    return (("", ext),(ext, name))[bool(name)]

I don't understand what the [bool(name)] does in the last line of code. What does it do and why is it important? Thank you!