<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def value(self):
 """ Return the node value, if we're a leaf node. Examples: True 2 TEST_X_Y=null TEST_X_Z=2 """


        def validate(node_value):
            if hasattr(node_value, 'validate'):
                node_value.validate()
            return node_value

        if 'value' in self.node:
            return validate(self.node['value'])
        return self