'Write configuration to a file-like object.'

def write_to_file(self, f):

    for (section, values) in self._values.items():
        try:
            (section_name, subsection_name) = section
        except ValueError:
            (section_name,) = section
            subsection_name = None
        if (subsection_name is None):
            f.write((('[' + section_name) + ']\n'))
        else:
            f.write((((('[' + section_name) + '    "') + subsection_name) + '"]\n'))
        for (key, value) in values.items():
            if (value is True):
                value = 'true'
            elif (value is False):
                value = 'false'
            else:
                value = _format_string(value)
            f.write(((((' DCTB ' + key) + '    =    ') + value) + '\n'))
