def CsvToTable(self, buf, header=True, separator=','):
    self.Reset()

    header_row = self.row_class()
    if header:
      line = buf.readline()
      header_str = ''
      while not header_str:
        # Remove comments.
        header_str = line.split('#')[0].strip()
        if not header_str:
          line = buf.readline()

      header_list = header_str.split(separator)
      header_length = len(header_list)

      for entry in header_list:
        entry = entry.strip()
        if entry in header_row:
          raise TableError('Duplicate header entry %r.' % entry)

        header_row[entry] = entry
      header_row.row = 0
      self._table[0] = header_row

    # xreadlines would be better but not supported by StringIO for testing.
    for line in buf:
      # Support commented lines, provide '#' is first character of line.
      if line.startswith('#'):
        continue

      lst = line.split(separator)
      lst = [l.strip() for l in lst]
      if header and len(lst) != header_length:
        # Silently drop illegal line entries
        continue
      if not header:
        header_row = self.row_class()
        header_length = len(lst)
        header_row.values = dict(zip(xrange(header_length),
                                     xrange(header_length)))
        self._table[0] = header_row
        header = True
        continue

      new_row = self.NewRow()
      new_row.values = lst
      header_row.row = self.size + 1
      self._table.append(new_row)

    return self.size
Creates a colored output.
dataset/ETHPy150Open google/textfsm/texttable.py/TextTable.CsvToTable--crossover with--dataset/ETHPy150Open OpenAssets/openassets/openassets/transactions.py/TransactionBuilder._get_colored_output