def predecesors_pattern(element, root):
    """
    Look for `element` by its predecesors.

    Args:
        element (obj): HTMLElement instance of the object you are looking for.
        root (obj): Root of the `DOM`.

    Returns:
        list: ``[PathCall()]`` - list with one :class:`PathCall` object (to \
              allow use with ``.extend(predecesors_pattern())``).
    """
    def is_root_container(el):
        return el.parent.parent.getTagName() == ""

    if not element.parent or not element.parent.parent or \
       is_root_container(element):
        return []

    trail = [
        [
            element.parent.parent.getTagName(),
            _params_or_none(element.parent.parent.params)
        ],
        [
            element.parent.getTagName(),
            _params_or_none(element.parent.params)
        ],
        [element.getTagName(), _params_or_none(element.params)],
    ]

    match = root.match(*trail)
    if element in match:
        return [
            PathCall("match", match.index(element), trail)
        ]
def predecesors_pattern ( element , root ) : def is_root_container ( el ) : return el . parent . parent . getTagName ( ) == "" if not element . parent or not element . parent . parent or is_root_container ( element ) : return [ ] trail = [ [ element . parent . parent . getTagName ( ) , _params_or_none ( element . parent . parent . params ) ] , [ element . parent . getTagName ( ) , _params_or_none ( element . parent . params ) ] , [ element . getTagName ( ) , _params_or_none ( element . params ) ] , ] match = root . match ( * trail ) if element in match : return [ PathCall ( "match" , match . index ( element ) , trail ) ]
Look for `element` by its predecesors.

    Args:
        element (obj): HTMLElement instance of the object you are looking for.
        root (obj): Root of the `DOM`.

    Returns:
        list: ``[PathCall()]`` - list with one :class:`PathCall` object (to \
              allow use with ``.extend(predecesors_pattern())``).