def in_order(self):
    if self.left is not None:
        for node in self.left.in_order():
            yield node
yield self
if self.right is not None:
    for node in self.right.in_order():
        yield node
Python in order traversal to a flat list