code: def _addvar(self, v):
          ''' Sets a new accessible variable.
  
          :param v: Variable.
          '''
          oldvar = self._oldvars.get(v.name)
          if oldvar is not None:
              if isinstance(oldvar, Variable):
                  if oldvar.compliesTo(v):
                      v.value = oldvar.value
              else:
                  # Set from commandline
                  v.value = v.sanitize(oldvar)
          else:
              for listener in VarListener.listeners:
                  listener.var_added(v)
          self._vars[v.name] = v
          self._namespace[v.name] = v.value
          self._oldvars[v.name] = v
          return f _addvar(self, v):
          ''' Sets a new accessible variable.
  
          :param v: Variable.
          '''
          oldvar = self._oldvars.get(v.name)
          if oldvar is not None:
              if isinstance(oldvar, Variable):
                  if oldvar.compliesTo(v):
                      v.value = oldvar.value
              else:
                  # Set from commandline
                  v.value = v.sanitize(oldvar)
          else:
              for listener in VarListener.listeners:
                  listener.var_added(v)
          self._vars[v.name] = v
          self._namespace[v.name] = v.value
          self._oldvars[v.name] = v
          return v
docs: Sets a new accessible variable.
  
          :param v: Variable.