def findNodeJustBefore(target, nodes):
    while target is not None:
        node = target.previousSibling
        while node is not None:
            if node in nodes:
                return node
            node = node.previousSibling
        target = target.parentNode
    raise RuntimeError("Oops")
Find the last Element which is a sibling of C{target} and is in C{nodes}.
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/lore/tree.py/findNodeJustBefore