Implementing Tree In Python