def execute_code(self, code, filename=None, isolate=False):
def _apply():<EOL><INDENT>self.compile_code(code=code,<EOL>filename=filename,<EOL>exec_namespace=self.globals)<EOL><DEDENT>if isolate:<EOL><INDENT>saved_globals = dict(self.globals)<EOL>try:<EOL><INDENT>_apply()<EOL><DEDENT>finally:<EOL><INDENT>self.globals.clear()<EOL>self.globals.update(saved_globals)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>_apply()<EOL><DEDENT>
Execute code within the execution context.

        Args:
            code (str or SourceCode): Rex code to execute.
            filename (str): Filename to report if there are syntax errors.
            isolate (bool): If True, do not affect `self.globals` by executing
                this code.