'Remove options which are present in the .ini file but not in defaults'

def _remove_deprecated_options(self, old_version):

    old_defaults = self._load_old_defaults(old_version)
    for section in old_defaults.sections():
        for (option, _) in old_defaults.items(section, raw=self.raw):
            if (self.get_default(section, option) is NoDefault):
                try:
                    self.remove_option(section, option)
                    if (len(self.items(section, raw=self.raw)) == 0):
                        self.remove_section(section)
                except cp.NoSectionError:
                    self.remove_section(section)
