def var_expand(self, cmd, depth=<NUM_LIT:0>, formatter=DollarFormatter()):
ns = self.user_ns.copy()<EOL>ns.update(sys._getframe(depth+<NUM_LIT:1>).f_locals)<EOL>ns.pop('<STR_LIT>', None)<EOL>try:<EOL><INDENT>cmd = formatter.format(cmd, **ns)<EOL><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT>return cmd<EOL>
Expand python variables in a string.

        The depth argument indicates how many frames above the caller should
        be walked to look for the local namespace where to expand variables.

        The global namespace for expansion is always the user's interactive
        namespace.