Beckman Coulter Diagnostics software can represent analyzer configuration data as binary trees. Given two such trees, determine whether they are identical, and stop traversing immediately when a difference is found.
Two trees are identical when corresponding nodes have the same integer value and the same structure. A missing child is represented by None.
Implement compare_trees(tree1, tree2). Each tree is either None or a dictionary with exactly three fields: value, left, and right. The left and right fields contain another tree or None. Return a boolean: True if the trees are identical, otherwise False.
Your implementation must short-circuit. Once a corresponding pair of nodes differs in value or structure, it must return without visiting any remaining subtrees.
def compare_trees(tree1, tree2):