+# a dict with some useful additional getters
+class AdvancedDict(dict):
+ def getstr(self, name, default = None):
+ if not name in self: return default
+ val = self[name]
+ if len(val) != 1: raise Exception('%s is a list, but it should not' % name)
+ return val[0]
+
+ def getint(self, name, default = None):
+ return int(self.getstr(name, default))
+
+ def getbool(self, name, default = None):
+ val = self.getstr(name, default)
+ if isinstance(val, bool): return val # already a bool
+ return val.lower() in ('true', 'yes', 'on', '1')
+
+# create a safe-to-call shell command from the array