import pathlib


def replace_marker(text: str, marker: str, src_filename: str, replace_marker_with_src_file: bool = True) -> str:
    """ replace a marker in the text with the content of a file, or with '' """
    if replace_marker_with_src_file:
        path_base_dir = pathlib.Path(__file__).parent
        path_src_filename = path_base_dir / src_filename
        with open(str(path_src_filename), 'r') as f_src_filename:
            s_src = f_src_filename.read()
            text = text.replace(marker, s_src)
    else:
        text = text.replace(marker, '')
    return text