def replace_range(new_content: str, target: str, start: int, end: int) -> str:
    """
    Replace `target[start:end]` with `new_content`.
    """
    if start > len(target):
        raise IndexError(
            f"start index {start} is too large for target string with length {len(target)}"
        )

    return target[:start] + new_content + target[end + 1 :]