def search_ancestry(element, predicate):
    """Run *predicate* against element's ancestry.

    :param element: an :class:`~flatland.schema.base.Element`

    :param predicate: a callable function. Will be passed one
      argument, an element.

    Returns the first non-false value emitted by *predicate*.
    AttributeError raised by *predicate* are treated as equivalent to
    a pass.  Any other exception is raised to the caller.

    """
    for obj in element_ancestry(element):
        try:
            transform = predicate(obj)
            if transform:
                return transform
        except __HOLE__:
            pass
dataset/ETHPy150Open jek/flatland/flatland/schema/util.py/search_ancestry