from typing import List


def _add_docstring_to_top_level_func(line: str, docstring: str) -> str:
    """
    Add docstring to the top-level function line string.

    Parameters
    ----------
    line : str
        Target function line string.
        e.g., `def sample_func(a: int) -> None:`
    docstring : str
        A doctring to add.

    Returns
    -------
    line : str
        Docstring added line str.
    """
    line += '\n    """'
    docstring_lines: List[str] = docstring.splitlines()
    for docstring_line in docstring_lines:
        if docstring_line == '':
            line += '\n'
            continue
        if not docstring_line.startswith('    '):
            docstring_line = f'    {docstring_line}'
        line += f'\n{docstring_line}'
    line += '\n    """'
    return line