<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_state(self, site, timestamp=None):
 """Write status dict to client status file. FIXME - should have some file lock to avoid race """

        parser = ConfigParser()
        parser.read(self.status_file)
        status_section = 'incremental'
        if (not parser.has_section(status_section)):
            parser.add_section(status_section)
        if (timestamp is None):
            parser.remove_option(
                status_section,
                self.config_site_to_name(site))
        else:
            parser.set(
                status_section,
                self.config_site_to_name(site),
                str(timestamp))
        with open(self.status_file, 'w') as configfile:
            parser.write(configfile)
            configfile.close()