def rst_underline(heading: str, underline_char: str) ->str:
    """
    Underlines a heading for RST files.

    Args:
        heading: text to underline
        underline_char: character to use

    Returns:
        underlined heading, over two lines (without a final terminating
        newline)
    """
    assert '\n' not in heading
    assert len(underline_char) == 1
    return heading + '\n' + underline_char * len(heading)
