code: def write_hdf5_segmentlist(seglist, output, path=None, **kwargs):
      
      if path is None:
          raise ValueError("Please specify the HDF5 path via the "
                           "``path=`` keyword argument")
  
      # convert segmentlist to Table
      data = numpy.zeros((len(seglist), 4), dtype=int)
      for i, seg in enumerate(seglist):
          start, end = map(LIGOTimeGPS, seg)
          data[i, :] = (start.gpsSeconds, start.gpsNanoSeconds,
                        end.gpsSeconds, end.gpsNanoSeconds)
      segtable = Table(data, names=['start_time', 'start_time_ns',
                                    'end_time', 'end_time_ns'])
  
      # write table to HDF5
      return segtable.write(output, path=path, format='hdf5', **kwargs)
docs: Write a `SegmentList` to an HDF5 file/group
  
      Parameters
      ----------
      seglist : :class:`~ligo.segments.segmentlist`
          data to write
  
      output : `str`, `h5py.File`, `h5py.Group`
          filename or HDF5 object to write to
  
      path : `str`
          path to which to write inside the HDF5 file, relative to ``output``
  
      **kwargs
          other keyword arguments are passed to
          :meth:`~astropy.table.Table.write`