def closest_value(root, target):
a = root.val<EOL>kid = root.left if target < a else root.right<EOL>if not kid:<EOL><INDENT>return a<EOL><DEDENT>b = closest_value(kid, target)<EOL>return min((a,b), key=lambda x: abs(target-x))<EOL>
:type root: TreeNode
:type target: float
:rtype: int