'Sets option to value, adding section if required.
Returns 1 if option was added or changed, otherwise 0.'

def SetOption(self, section, option, value):

    if self.has_option(section, option):
        if (self.get(section, option) == value):
            return 0
        else:
            self.set(section, option, value)
            return 1
    else:
        if (not self.has_section(section)):
            self.add_section(section)
        self.set(section, option, value)
        return 1
