'Write header information in the ECSV ASCII format.  This format
starts with a delimiter separated list of the column names in order
to make this format readable by humans and simple csv-type readers.
It then encodes the full table meta and column attributes and meta
as YAML and pretty-prints this in the header.  Finally the delimited
column names are repeated again, for humans and readers that look
for the *last* comment line as defining the column names.'

def write(self, lines):

    if (self.splitter.delimiter not in DELIMITERS):
        raise ValueError('only    space    and    comma    are    allowed    for    delimiter    in    ECSV    format')
    for col in self.cols:
        if (len(getattr(col, 'shape', ())) > 1):
            raise ValueError("ECSV    format    does    not    support    multidimensional    column    '{0}'".format(col.info.name))
    header = {'cols': self.cols, 'schema': 'astropy-2.0'}
    if self.table_meta:
        header['meta'] = self.table_meta
    if (self.splitter.delimiter != '    '):
        header['delimiter'] = self.splitter.delimiter
    header_yaml_lines = (['%ECSV    {0}'.format(ECSV_VERSION), '---'] + meta.get_yaml_from_header(header))
    lines.extend([(self.write_comment + line) for line in header_yaml_lines])
    lines.append(self.splitter.join([x.info.name for x in self.cols]))
