def performXpath(parent, xpath):
    """ Perform an XPath on an element and indicate if we need to loop over it to find something

    :param parent: XML Node on which to perform XPath
    :param xpath: XPath to run
    :return: (Result, Need to loop Indicator)
    """
    loop = False
    if xpath.startswith(".//"):
        result = parent.xpath(
            xpath.replace(".//", "./", 1),
            namespaces=XPATH_NAMESPACES
        )
        if len(result) == 0:
            result = parent.xpath(
                "*[{}]".format(xpath),
                namespaces=XPATH_NAMESPACES
            )
            loop = True
    else:
        result = parent.xpath(
            xpath,
            namespaces=XPATH_NAMESPACES
        )
    return result[0], loop
def performXpath ( parent , xpath ) : loop = False if xpath . startswith ( ".//" ) : result = parent . xpath ( xpath . replace ( ".//" , "./" , 1 ) , namespaces = XPATH_NAMESPACES ) if len ( result ) == 0 : result = parent . xpath ( "*[{}]" . format ( xpath ) , namespaces = XPATH_NAMESPACES ) loop = True else : result = parent . xpath ( xpath , namespaces = XPATH_NAMESPACES ) return result [ 0 ] , loop
Perform an XPath on an element and indicate if we need to loop over it to find something

    :param parent: XML Node on which to perform XPath
    :param xpath: XPath to run
    :return: (Result, Need to loop Indicator)