def get_note_ancestor(e):
    """
    Return the first ancestor of `e` with tag "note", or None if there is no such
    ancestor.
    """
    for a in e.iterancestors():
        if a.tag == 'note':
            return a
    return None