def replace(self, variable, expression, replace_bound=False, alpha_convert=True):
        first = self.first
        second = self.second
        consequent = self.consequent

        # If variable is bound
        if variable in self.get_refs():
            if replace_bound:
                first  = first.replace(variable, expression, replace_bound, alpha_convert)
                second = second.replace(variable, expression, replace_bound, alpha_convert)
                if consequent:
                    consequent = consequent.replace(variable, expression, replace_bound, alpha_convert)
        else:
            if alpha_convert:
                # alpha convert every ref that is free in 'expression'
                for ref in (set(self.get_refs(True)) & expression.free()):
                    v = DrtVariableExpression(unique_variable(ref))
                    first  = first.replace(ref, v, True, alpha_convert)
                    second = second.replace(ref, v, True, alpha_convert)
                    if consequent:
                        consequent = consequent.replace(ref, v, True, alpha_convert)

            first  = first.replace(variable, expression, replace_bound, alpha_convert)
            second = second.replace(variable, expression, replace_bound, alpha_convert)
            if consequent:
                consequent = consequent.replace(variable, expression, replace_bound, alpha_convert)

        return self.__class__(first, second, consequent)
Replace all instances of variable v with expression E in self,
dataset/ETHPy150Open nltk/nltk/nltk/sem/drt.py/DrtConcatenation.replace