def titled_table(
    title_str: str,
    table_str: str,
    symbol: str = "-",
    n_empty_start: int = 1,
    n_empty_end: int = 0,
) -> str:
    """
    Adds an underlined title string to a given table string. The line, that underlines
    the title will be as long as the longest line of the table.

    Parameters
    ----------
    title_str
        The title to be put on top of the table.
    table_str
        The string representing the table. For example generated using tabulate.
    symbol
        A single character the line should be 'made' of.
    n_empty_start
        Number of empty lines added before the title.
    n_empty_end
        Number of empty lines added after the table string.

    Returns
    -------
    result_string
        An underlined title, followed by a table.
    """
    # get the number of characters in the given table's longest line
    max_line_length = max([len(line) for line in table_str.split("\n")])
    # now, simply concatenate the different lines
    result_string = (
        n_empty_start * "\n"
        + title_str
        + "\n"
        + max_line_length * symbol
        + "\n"
        + table_str
        + "\n"
        + n_empty_end * "\n"
    )
    return result_string