code: def _format_table(fmt, headers, rows, colwidths, colaligns):
      """Produce a plain-text representation of the table."""
      lines = []
      hidden = (
          fmt.with_header_hide
          if (headers and fmt.with_header_hide)
          else []
      )
      pad = fmt.padding
      headerrow = fmt.headerrow
  
      padded_widths = [(w + 2 * pad) for w in colwidths]
      padded_headers = _pad_row(headers, pad)
      padded_rows = [_pad_row(row, pad) for row in rows]
  
      if fmt.lineabove and "lineabove" not in hidden:
          lines.append(
              _build_line(padded_widths, colaligns, fmt.lineabove)
          )
  
      if padded_headers:
          lines.append(
              _build_row(
                  padded_headers, padded_widths, colaligns, headerrow
              )
          )
          if fmt.linebelowheader and "linebelowheader" not in hidden:
              lines.append(
                  _build_line(
                      padded_widths, colaligns, fmt.linebelowheader
                  )
              )
  
      if (
          padded_rows
          and fmt.linebetweenrows
          and "linebetweenrows" not in hidden
      ):
          # initial rows with a line below
          for row in padded_rows[:-1]:
              lines.append(
                  _build_row(row, padded_widths, colaligns, fmt.datarow)
              )
              lines.append(
                  _build_line(
                      padded_widths, colaligns, fmt.linebetweenrows
                  )
              )
          # the last row without a line below
          lines.append(
              _build_row(
                  padded_rows[-1], padded_widths, colaligns, fmt.datarow
              )
          )
      else:
          for row in padded_rows:
              lines.append(
                  _build_row(row, padded_widths, colaligns, fmt.datarow)
              )
  
      if fmt.linebelow and "linebelow" not in hidden:
          lines.append(
              _build_line(padded_widths, colaligns, fmt.linebelow)
          )
  
      return "\n".join(lines)
  
imports: from __future__ import print_function
  from __future__ import unicode_literals
  from collections import namedtuple
  from platform import python_version_tuple
  import re
label_desc: Use image node_id 27 for calling a global function with example usage: _format_table(fmt, headers, rows, colwidths, colaligns) and returns: str