code: def as_text(self, max_rows=0, sep=" | "):
          
          if not max_rows or max_rows > self.num_rows:
              max_rows = self.num_rows
          omitted = max(0, self.num_rows - max_rows)
          labels = self._columns.keys()
          fmts = self._get_column_formatters(max_rows, False)
          rows = [[fmt(label, label=True) for fmt, label in zip(fmts, labels)]]
          for row in itertools.islice(self.rows, max_rows):
              rows.append([f(v, label=False) for v, f in zip(row, fmts)])
          lines = [sep.join(row) for row in rows]
          if omitted:
              lines.append('... ({} rows omitted)'.format(omitted))
          return '\n'.join([line.rstrip() for line in lines])
docs: Format table as text.