def __init__(self, interpreter=None, globals_map=None, parent_environ=None,<EOL>parent_variables=None, shebang=True, add_default_namespaces=True):
self.globals = globals_map or {}<EOL>self.formatter = NamespaceFormatter(self.globals)<EOL>self.bind('<STR_LIT>', self.expand)<EOL>self.bind('<STR_LIT>', literal)<EOL>self.bind('<STR_LIT>', expandable)<EOL>if interpreter is None:<EOL><INDENT>interpreter = Python(target_environ={})<EOL><DEDENT>self.manager = ActionManager(interpreter,<EOL>formatter=self.expand,<EOL>parent_environ=parent_environ,<EOL>parent_variables=parent_variables)<EOL>if isinstance(interpreter, Python):<EOL><INDENT>interpreter.set_manager(self.manager)<EOL><DEDENT>if shebang:<EOL><INDENT>self.manager.shebang()<EOL><DEDENT>self.environ = EnvironmentDict(self.manager)<EOL>self.bind('<STR_LIT>', AttrDictWrapper(self.environ))<EOL>for cmd, func in self.manager.get_public_methods():<EOL><INDENT>self.bind(cmd, func)<EOL><DEDENT>if add_default_namespaces:<EOL><INDENT>self.bind('<STR_LIT>', system)<EOL><DEDENT>
interpreter: `ActionInterpreter` or None
    the interpreter to use when executing rex actions. If None, creates
    a python interpreter with an empty target environment dict.
globals_map : dict or None
    dictionary which comprises the main python namespace when rex code
    is executed (via the python `exec` statement). if None, defaults
    to empty dict.
parent_environ: environment to execute the rex code within. If None, defaults
    to the current environment.
parent_variables: List of variables to append/prepend to, rather than
    overwriting on first reference. If this is set to True instead of a
    list, all variables are treated as parent variables.
shebang: bool
    if True, apply a shebang to the result.
add_default_namespaces: bool
    whether to add default namespaces such as 'system'.