def is_section_elem(
    section: SECSection, elem: Text, filing_type: Optional[str]
) -> bool:
    """Checks to see if a text element matches the section title for a given filing type."""
    _raise_for_invalid_filing_type(filing_type)
    if section is SECSection.RISK_FACTORS:
        return is_risk_title(elem.text, filing_type=filing_type)
    else:

        def _is_matching_section_pattern(text):
            return bool(
                re.search(section.pattern, clean_sec_text(text, lowercase=True))
            )

        if filing_type in REPORT_TYPES:
            return _is_matching_section_pattern(
                remove_item_from_section_text(elem.text)
            )
        else:
            return _is_matching_section_pattern(elem.text)
Checks to see if a text element matches the section title for a given filing type.
llama-index-integrations/readers/llama-index-readers-sec-filings/llama_index/readers/sec_filings/prepline_sec_filings/sec_document.py