def check_leaf(self):
     """ Leaf validity rules:
         - a valid leaf is an operator or a leaf
         - a valid leaf has a field objects unless
             - it is not a tuple
             - it is an inherited field
             - left is id, operator is 'child_of'
             - left is in MAGIC_COLUMNS
     """
     if not is_operator(self.leaf) and not is_leaf(self.leaf, True):
         raise ValueError("Invalid leaf %s" % str(self.leaf))
 def is_operator(self):
     return is_operator(self.leaf)