t = Tree.parse(
    '(S (S (S (S (X (PRO pro))) (X (V v))) (X (ADJ adj))) (X (N n)))')
print(list(get_pairs(t, 'X')))
NLTK: how can I list all pairs of adjacent subtrees (rooted in specific nonterminal) of a parse tree