code: def list_tables(source):
      # pylint: disable=line-too-long
        # noqa: E501
      try:
          from ligo.lw.ligolw import (Document, Stream)
      except ImportError:  # no python-ligo-lw
          from glue.ligolw.ligolw import Document, Stream
  
      # read file object
      if isinstance(source, Document):
          xmldoc = source
      else:
          filt = get_filtering_contenthandler(Stream)
          xmldoc = read_ligolw(source, contenthandler=filt)
  
      # get list of table names
      tables = []
      for tbl in xmldoc.childNodes[0].childNodes:
          try:
              tables.append(tbl.TableName(tbl.Name))
          except AttributeError:  # not a table
              continue
      return tables
docs: List the names of all tables in this file(s)
  
      Parameters
      ----------
      source : `file`, `str`, :class:`~ligo.lw.ligolw.Document`, `list`
          one or more open files, file paths, or LIGO_LW `Document`s
  
      Examples
      --------
      >>> from gwpy.io.ligolw import list_tables
      >>> print(list_tables('H1-LDAS_STRAIN-968654552-10.xml.gz'))
      ['process', 'process_params', 'sngl_burst', 'search_summary', 'segment_definer', 'segment_summary', 'segment']