def METHOD_NAME(tree):
    NPs = [sub_tree for sub_tree in tree if toolbox.is_tree(sub_tree)]
    if NPs:
        root_np = NPs.pop()
        return {'term': toolbox.np_processor(root_np), 'tree': root_np}
    else:
        return {'term': toolbox.np_processor(tree), 'tree': tree