def to_child(self, append_message="<STR_LIT>", node_name="<STR_LIT>", **kwargs):
base_kwargs = {<EOL>attr: getattr(self, attr)<EOL>for attr in self.params<EOL>if attr not in ["<STR_LIT>"]<EOL>}<EOL>if not isinstance(append_message, dict):<EOL><INDENT>append_message = {"<STR_LIT>": append_message, "<STR_LIT>": {}}<EOL><DEDENT>kwargs["<STR_LIT>"] = [*self.messages, append_message]<EOL>kwargs["<STR_LIT>"] = self<EOL>for kwarg in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>if kwarg in kwargs and not kwargs[kwarg]:<EOL><INDENT>kwargs.pop(kwarg, None)<EOL><DEDENT><DEDENT>def update_kwarg(name, func):<EOL><INDENT>kwargs[name] = func(kwargs[name])<EOL><DEDENT>def update_context(name):<EOL><INDENT>update_kwarg(name, getattr(self, name).update_ctx)<EOL><DEDENT>if isinstance(kwargs.get("<STR_LIT>", None), list):<EOL><INDENT>update_kwarg("<STR_LIT>", wrap_in_module)<EOL><DEDENT>if isinstance(kwargs.get("<STR_LIT>", None), list):<EOL><INDENT>update_kwarg("<STR_LIT>", wrap_in_module)<EOL><DEDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>kwargs["<STR_LIT>"] = self.student_ast_tokens.get_text(<EOL>kwargs["<STR_LIT>"]<EOL>)<EOL><DEDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>kwargs["<STR_LIT>"] = self.solution_ast_tokens.get_text(<EOL>kwargs["<STR_LIT>"]<EOL>)<EOL><DEDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>update_context("<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>update_context("<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>update_context("<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>update_context("<STR_LIT>")<EOL><DEDENT>klass = self.SUBCLASSES[node_name] if node_name else State<EOL>child = klass(**{**base_kwargs, **kwargs})<EOL>return child<EOL>
Dive into nested tree.

        Set the current state as a state with a subtree of this syntax tree as
        student tree and solution tree. This is necessary when testing if statements or
        for loops for example.