def get_narrative_texts(
    doc: HTMLDocument, up_to_next_title: Optional[bool] = False
) -> List[Text]:
    """
    Returns a list of NarrativeText or ListItem from document,
    with option to return narrative texts only up to next Title element.
    """
    if up_to_next_title:
        narrative_texts = []
        for el in doc.elements:
            if isinstance(el, (NarrativeText, ListItem)):
                narrative_texts.append(el)
            else:
                break
        return narrative_texts
    else:
        return [el for el in doc.elements if isinstance(el, (NarrativeText, ListItem))]

    Returns a list of NarrativeText or ListItem from document,
    with option to return narrative texts only up to next Title element.
    
llama-index-integrations/readers/llama-index-readers-sec-filings/llama_index/readers/sec_filings/prepline_sec_filings/sec_document.py