def __contains__(self, expr):
        """
        Test if expr is a subterm of this expression.
        """
        if expr in self.args:
            return True

        if isinstance(expr, self.__class__):
            return all(arg in self.args for arg in expr.args)
def __contains__ ( self , expr ) : if expr in self . args : return True if isinstance ( expr , self . __class__ ) : return all ( arg in self . args for arg in expr . args )
Test if expr is a subterm of this expression.