def replace(self, *varsets):
    'Checks each part of the statement against defined variables. If any\n        matches are found, the statement is updated. If the statement is a function\n        call, a new set of statements is returned; otherwise, None is returned.'
    matched = False
    subj = self.subject
    if isinstance(subj, Variable):
        (result, new_match) = def_match(subj, varsets)
        if result:
            self.subject = new_match
            return self.replace(*varsets)
    for (n, (verb, objects)) in enumerate(self.verb_objects):
        if isinstance(verb, Variable):
            (result, new_match) = def_match(verb, varsets)
            if result:
                (v, o) = self.verb_objects[n]
                self.verb_objects[n] = (new_match, o)
                return self.replace(*varsets)
        for (m, obj) in enumerate(objects):
            if isinstance(obj, Variable):
                (result, new_match) = def_match(obj, varsets)
                if result:
                    objects[m] = new_match
                    return self.replace(*varsets)
    return None
Checks each part of the statement against defined variables. If any
matches are found, the statement is updated. If the statement is a function
call, a new set of statements is returned; otherwise, None is returned.
def replace(self, *varsets):
    'Checks each part of the statement against defined variables. If any\n        matches are found, the statement is updated. If the statement is a function\n        call, a new set of statements is returned; otherwise, None is returned.'
    matched = False
    subj = self.subject
    if isinstance(subj, Variable):
        (result, new_match) = def_match(subj, varsets)
        if result:
            self.subject = new_match
            return self.replace(*varsets)
    for (n, (verb, objects)) in enumerate(self.verb_objects):
        if isinstance(verb, Variable):
            (result, new_match) = def_match(verb, varsets)
            if result:
                (v, o) = self.verb_objects[n]
                self.verb_objects[n] = (new_match, o)
                return self.replace(*varsets)
        for (m, obj) in enumerate(objects):
            if isinstance(obj, Variable):
                (result, new_match) = def_match(obj, varsets)
                if result:
                    objects[m] = new_match
                    return self.replace(*varsets)
    return None