code: def _setdef(argdict, name, defaultvalue):
      
      if not name in argdict or argdict[name] is None:
          argdict[name] = defaultvalue
      return argdict[name]
docs: Like dict.setdefault but sets the default value also if None is present.