def _addvar(self, v):
oldvar = self._oldvars.get(v.name)<EOL>if oldvar is not None:<EOL><INDENT>if isinstance(oldvar, Variable):<EOL><INDENT>if oldvar.compliesTo(v):<EOL><INDENT>v.value = oldvar.value<EOL><DEDENT><DEDENT>else:<EOL><INDENT>v.value = v.sanitize(oldvar)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for listener in VarListener.listeners:<EOL><INDENT>listener.var_added(v)<EOL><DEDENT><DEDENT>self._vars[v.name] = v<EOL>self._namespace[v.name] = v.value<EOL>self._oldvars[v.name] = v<EOL>return v<EOL>
Sets a new accessible variable.

        :param v: Variable.