def write(self, path, result):
        keys = list(result.keys())
        if path not in self.handles:
            # handle fileobj that has been passed in:
            if path is not None:
                if PY3:  # pragma: no cover
                    fh = open(path, 'wt', encoding='utf8', newline='')
                else:
                    fh = open(path, 'wb')
            else:
                fh = self.fileobj

            writer = csv.writer(fh)
            if PY3:  # pragma: no cover
                writer.writerow(keys)
            else:
                writer.writerow([value_to_str(k) for k in keys])
            self.handles[path] = (writer, fh)
        writer, fh = self.handles[path]
        values = [value_to_str(result.get(k)) for k in keys]
        writer.writerow(values)
dataset/ETHPy150Open pudo/dataset/dataset/freeze/format/fcsv.py/CSVSerializer.write/original