def __call__(self, date, ctx):
        # get the node values from the context
        values = [ctx.get_value(node) for node in self.nodes]

        # get the writer from the context, or create it if it's not been
        # created already.
        ctx_id = ctx.get_id()
        try: 
            writer = self.writers[ctx_id]
        except __HOLE__:
            fh = self.fh
            if isinstance(fh, MDFNode):
                fh = ctx.get_value(fh)
            if isinstance(fh, basestring):
                fh = open(fh, "wb")
                self.open_fhs.append(fh)
            writer = self.writers[ctx_id] = csv.writer(fh)

        # figure out how to handle them and what to write in the header
        if self.handlers is None:
            header = ["date"]
            self.handlers = []
            for node, value, column in zip(self.nodes, values, self.columns):
                if isinstance(column, MDFNode):
                    column = ctx.get_value(column)
                header.extend(_get_labels(node, column, value))

                if isinstance(value, (basestring, int, float, bool, datetime.date)):
                    self.handlers.append(self._write_basetype)
                elif isinstance(value, (list, tuple, np.ndarray, pa.Index, pa.core.generic.NDFrame)):
                    self.handlers.append(self._write_list)
                elif isinstance(value, pa.Series):
                    self.handlers.append(self._write_series)
                else:
                    raise Exception("Unhandled type %s for node %s" % (type(value), node))

            # write the header
            writer.writerow(header)

        # format the values and write the row
        row = [date]
        for handler, value in zip(self.handlers, values):
            handler(value, row)
        writer.writerow(row)
dataset/ETHPy150Open manahl/mdf/mdf/builders/basic.py/CSVWriter.__call__