code: def table_extend(tables, keep_headers=True):
      """extend a list of SimpleTables, adding titles to header of subtables
  
      This function returns the merged table as a deepcopy, in contrast to the
      SimpleTable extend method.
  
      Parameters
      ----------
      tables : list of SimpleTable instances
      keep_headers : bool
          If true, then all headers are kept. If falls, then the headers of
          subtables are blanked out.
  
      Returns
      -------
      table_all : SimpleTable
          merged tables as a single SimpleTable instance
  
      """
      from copy import deepcopy
  
      for ii, t in enumerate(tables[:]):  # [1:]:
          t = deepcopy(t)
  
          # move title to first cell of header
          # TODO: check if we have multiline headers
          if t[0].datatype == "header":
              t[0][0].data = t.title
              t[0][0]._datatype = None
              t[0][0].row = t[0][1].row
              if not keep_headers and (ii > 0):
                  for c in t[0][1:]:
                      c.data = ""
  
          # add separating line and extend tables
          if ii == 0:
              table_all = t
          else:
              r1 = table_all[-1]
              r1.add_format("txt", row_dec_below="-")
              table_all.extend(t)
  
      table_all.title = None
      return table_all
  
imports: from statsmodels.compat.python import lmap, lrange, lzip
  import copy
  from itertools import zip_longest
  import time
  import numpy
  from statsmodels.iolib.table import SimpleTable
  from statsmodels.iolib.tableformatting import fmt_2, fmt_2cols, fmt_params, gen_fmt
  from .summary2 import _model_types
label_desc: Use image node_id 10 for calling a global function with example usage: table_extend(tables, keep_headers) and returns: table_all