code: def _table_format(
      data, headers=None, index=None, extra_spaces=0, h_bars=None
  ):
      if headers is not None:
          data.insert(0, headers)
      if index is not None:
          index.insert(0, "")
          for idx, row in zip(index, data):
              row.insert(0, idx)
  
      column_widths = np.asarray(
          [[len(str(v)) for v in row] for row in data]
      ).max(axis=0)
  
      row_fmt = (
          " | ".join(
              ["{:>%d}" % (w + extra_spaces) for w in column_widths][1:]
          )
          + "\n"
      )
      if index is not None:
          row_fmt = (
              "{:<%d} | " % (column_widths[0] + extra_spaces) + row_fmt
          )
  
      output = ""
      for i, row in enumerate(data):
          if h_bars is not None and i in h_bars:
              output += row_fmt.format(
                  *["-" * (w + extra_spaces) for w in column_widths]
              ).replace("|", "+")
          output += row_fmt.format(*row)
      return output
  
imports: import numpy
  from collections import OrderedDict
label_desc: Use image node_id 1 for calling a global function with example usage: _table_format(data, headers, index, extra_spaces, h_bars) and returns: output