def find_elements(node, xpath, allow_zero=True, allow_multiple=True):
    """Attempt to find child elements in a node by xpath. Raise exceptions if conditions are violated. Return a
    (possibly empty) list of elements."""
    all_elements = node.findall(xpath)
    if (len(all_elements) == 0 and not allow_zero) or (len(all_elements) > 1 and not allow_multiple):
        raise AssertionError(f'Found {len(all_elements)} instances of {xpath} in {node}, which is not allowed')
    return all_elements