Least Common Ancestor, written in python