code: def summary_top(
      results,
      title=None,
      gleft=None,
      gright=None,
      yname=None,
      xname=None,
  ):
      """generate top table(s)
  
  
      TODO: this still uses predefined model_methods
      ? allow gleft, gright to be 1 element tuples instead of filling with None?
  
      """
      # change of names ?
      gen_left, gen_right = gleft, gright
  
      # time and names are always included
      time_now = time.localtime()
      time_of_day = [time.strftime("%H:%M:%S", time_now)]
      date = time.strftime("%a, %d %b %Y", time_now)
  
      yname, xname = _getnames(results, yname=yname, xname=xname)
  
      # create dictionary with default
      # use lambdas because some values raise exception if they are not available
      default_items = dict(
          [
              ("Dependent Variable:", lambda: [yname]),
              ("Dep. Variable:", lambda: [yname]),
              ("Model:", lambda: [results.model.__class__.__name__]),
              ("Date:", lambda: [date]),
              ("Time:", lambda: time_of_day),
              ("Number of Obs:", lambda: [results.nobs]),
              ("No. Observations:", lambda: [d_or_f(results.nobs)]),
              ("Df Model:", lambda: [d_or_f(results.df_model)]),
              ("Df Residuals:", lambda: [d_or_f(results.df_resid)]),
              (
                  "Log-Likelihood:",
                  lambda: ["%#8.5g" % results.llf],
              ),  # does not exist for RLM - exception
          ]
      )
  
      if title is None:
          title = (
              results.model.__class__.__name__ + "Regression Results"
          )
  
      if gen_left is None:
          # default: General part of the summary table, Applicable to all? models
          gen_left = [
              ("Dep. Variable:", None),
              ("Model type:", None),
              ("Date:", None),
              ("No. Observations:", None),
              ("Df model:", None),
              ("Df resid:", None),
          ]
  
          try:
              llf = results.llf  # noqa: F841
              gen_left.append(("Log-Likelihood", None))
          except:  # AttributeError, NotImplementedError
              pass
  
          gen_right = []
  
      gen_title = title
      gen_header = None
  
      # replace missing (None) values with default values
      gen_left_ = []
      for item, value in gen_left:
          if value is None:
              value = default_items[
                  item
              ]()  # let KeyErrors raise exception
          gen_left_.append((item, value))
      gen_left = gen_left_
  
      if gen_right:
          gen_right_ = []
          for item, value in gen_right:
              if value is None:
                  value = default_items[
                      item
                  ]()  # let KeyErrors raise exception
              gen_right_.append((item, value))
          gen_right = gen_right_
  
      # check nothing was missed
      missing_values = [k for k, v in gen_left + gen_right if v is None]
      assert missing_values == [], missing_values
  
      # pad both tables to equal number of rows
      if gen_right:
          if len(gen_right) < len(gen_left):
              # fill up with blank lines to same length
              gen_right += [(" ", " ")] * (
                  len(gen_left) - len(gen_right)
              )
          elif len(gen_right) > len(gen_left):
              # fill up with blank lines to same length, just to keep it symmetric
              gen_left += [(" ", " ")] * (
                  len(gen_right) - len(gen_left)
              )
  
          # padding in SimpleTable does not work like I want
          # force extra spacing and exact string length in right table
          gen_right = [("%-21s" % ("  " + k), v) for k, v in gen_right]
          gen_stubs_right, gen_data_right = zip_longest(
              *gen_right
          )  # transpose row col
          gen_table_right = SimpleTable(
              gen_data_right,
              gen_header,
              gen_stubs_right,
              title=gen_title,
              txt_fmt=fmt_2cols,
          )
      else:
          gen_table_right = (
              []
          )  # because .extend_right seems works with []
  
      # moved below so that we can pad if needed to match length of gen_right
      # transpose rows and columns, `unzip`
      gen_stubs_left, gen_data_left = zip_longest(
          *gen_left
      )  # transpose row col
  
      gen_table_left = SimpleTable(
          gen_data_left,
          gen_header,
          gen_stubs_left,
          title=gen_title,
          txt_fmt=fmt_2cols,
      )
  
      gen_table_left.extend_right(gen_table_right)
      general_table = gen_table_left
  
      return general_table
  
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 5 for calling a global function with example usage: summary_top(results, title, gleft, gright, yname, xname) and returns: general_table