def METHOD_NAME(self, outfile):
    colors = set()
    for _, ndef in self.style:
        if ndef['color'] is not None:
            colors.add(ndef['color'])
    for color in sorted(colors):
        outfile.write('.defcolor ' + color + ' rgb #' + color + '\n')