def format_world_name(home_world, main_world, linked_worlds, world_names):
    """
    Returns a formatted text fragment representing the given world plus its linked worlds.

    If any of the worlds is the home world, it will be underlined.
    """

    ft = [
        ("underline" if main_world == home_world else "", world_names[main_world]),
    ]

    first_lw = True
    for lw in linked_worlds:
        if first_lw:
            ft.append(("", " (+ "))
            first_lw = False
        else:
            ft.append(("", ", "))
        ft.append(("underline" if lw == home_world else "", world_names[lw]))

    if not first_lw:
        ft.append(("", ")"))

    return ft