'Write the table data in the ASCII format read by BinTableHDU.load()
to fileobj.'

def _dump_data(self, fileobj):

    if ((not fileobj) and self._file):
        root = os.path.splitext(self._file.name)[0]
        fileobj = (root + '.txt')
    close_file = False
    if isinstance(fileobj, string_types):
        fileobj = open(fileobj, 'w')
        close_file = True
    linewriter = csv.writer(fileobj, dialect=FITSTableDumpDialect)
    def format_value(val, format):
        if (format[0] == 'S'):
            itemsize = int(format[1:])
            return '{:{size}}'.format(val, size=itemsize)
        elif (format in np.typecodes['AllInteger']):
            return '{:21d}'.format(val)
        elif (format in np.typecodes['Complex']):
            return '{:21.15g}+{:.15g}j'.format(val.real, val.imag)
        elif (format in np.typecodes['Float']):
            if six.PY2:
                return ('%#21.15g' % val)
            else:
                return '{:#21.15g}'.format(val)
    for row in self.data:
        line = []
        for column in self.columns:
            vla_format = None
            format = _convert_format(column.format)
            if isinstance(format, _FormatP):
                line.append('VLA_Length=')
                line.append('{:21d}'.format(len(row[column.name])))
                (_, dtype, option) = _parse_tformat(column.format)
                vla_format = FITS2NUMPY[option[0]][0]
            if vla_format:
                for val in row[column.name].flat:
                    line.append(format_value(val, vla_format))
            else:
                dtype = self.data.dtype.fields[column.name][0]
                array_format = dtype.char
                if (array_format == 'V'):
                    array_format = dtype.base.char
                if (array_format == 'S'):
                    array_format += str(dtype.itemsize)
                if (dtype.char == 'V'):
                    for value in row[column.name].flat:
                        line.append(format_value(value, array_format))
                else:
                    line.append(format_value(row[column.name], array_format))
        linewriter.writerow(line)
    if close_file:
        fileobj.close()
