import re


def sanitize_cdata(xmlstr: str) -> str:
    """
    Some xml strings come from david with double escaped cdata (see
    david_weird_cdata.xml for an example). The closing double tag has
    to be deleted in order for xmltodict to be able to parse.
    Args:
        xmlstr: An unparsed xml string from david
    Returns: xmlstr to be parsed without cdata
    """
    CDATA_REGEX = re.compile(r'<!\[CDATA\[.*\]\]>', re.MULTILINE)

    sanitized_str = CDATA_REGEX.sub(' ', xmlstr)
    return sanitized_str