code: def to_astropy_table(llwtable, apytable, copy=False, columns=None,
                       use_numpy_dtypes=False, rename=None):
      
      # set default keywords
      if rename is None:
          rename = {}
      if columns is None:
          columns = llwtable.columnnames
  
      # extract columns from LIGO_LW table as astropy.table.Column
      data = []
      for colname in columns:
          arr = _get_column(llwtable, colname)
  
          # transform to astropy.table.Column
          copythis = isinstance(arr, numpy.ndarray)
          data.append(to_astropy_column(arr, apytable.Column, copy=copythis,
                                        use_numpy_dtype=use_numpy_dtypes,
                                        name=rename.get(colname, colname)))
  
      # build table and return
      return apytable(data, copy=False, meta={'tablename': str(llwtable.Name)})
docs: Convert a :class:`~ligo.lw.table.Table` to an `~astropy.tableTable`
  
      This method is designed as an internal method to be attached to
      :class:`~ligo.lw.table.Table` objects as `__astropy_table__`.
  
      Parameters
      ----------
      llwtable : :class:`~ligo.lw.table.Table`
          the LIGO_LW table to convert from
  
      apytable : `type`
          `astropy.table.Table` class or subclass
  
      copy : `bool`, optional
          if `True` copy the input data, otherwise return a reference,
          default: `False`
  
      columns : `list` of `str`, optional
          the columns to populate, if not given, all columns present in the
          table are mapped
  
      use_map_dtypes : `bool`, optional
          force column `dtypes
  
      rename : `dict`, optional
          dict of ('old name', 'new name') pairs to rename columns
          from the original LIGO_LW table
  
      Returns
      -------
      table : `EventTable`
          a view of the original data