def findall(root, xpath, attribute_name=None, attribute_value=None):
    """Find elements recursively from given root element based on
    xpath and possibly given attribute

    :param root: Element root element where to start search
    :param xpath: xpath defintion, like {http://foo/bar/namespace}ElementName
    :param attribute_name: name of possible attribute of given element
    :param attribute_value: value of the attribute
    :return: list of elements or None
    """

    found_elements = []


    # python 2.6 < does not support complicated XPATH expressions used lower
    if (2, 6) == sys.version_info[0:2] and which_etree() != 'lxml.etree':

        elements = root.getiterator(xpath)

        if attribute_name in None and attribute_value is not None:
            for element in elements:
                if element.attrib.get(attribute_name) == attribute_value:
                    found_elements.append(element)
        else:
            found_elements = elements
    # python at least 2.7 and/or lxml can do things much simplier
    else:
        if attribute_name is not None and attribute_value is not None:
            xpath = '%s[@%s="%s"]' % (xpath, attribute_name, attribute_value)
        found_elements = root.findall('.//' + xpath)

    if found_elements == []:
        found_elements = None
    return found_elements
dataset/ETHPy150Open geopython/OWSLib/owslib/util.py/findall/operator `is not` -> `in`