def update_xpath(nsmap, xml, recprop):
    """Update XML document XPath values"""

    if isinstance(xml, binary_type) or isinstance(xml, text_type):
        # serialize to lxml
        xml = etree.fromstring(xml, PARSER)

    recprop = eval(recprop)
    nsmap = eval(nsmap)
    try:
        nodes = xml.xpath(recprop['rp']['xpath'], namespaces=nsmap)
        if len(nodes) > 0:  # matches
            for node1 in nodes:
                if node1.text != recprop['value']:  # values differ, update
                    node1.text = recprop['value']
    except Exception as err:
        print(err)
        raise RuntimeError(str(err) % 'ERROR: %s')

    return etree.tostring(xml)
dataset/ETHPy150Open geopython/pycsw/pycsw/core/util.py/update_xpath/swapped operands of `%`