code: def get_availability(channels, start, end,
                       connection=None, host=None, port=None):
      # pylint: disable=unused-argument
      
      from ..segments import (Segment, SegmentList, SegmentListDict)
      connection.set_epoch(start, end)
      # map user-given real names to NDS names
      names = list(map(
          _get_nds2_name, find_channels(channels, epoch=(start, end),
                                        connection=connection, unique=True),
      ))
      # query for availability
      result = connection.get_availability(names)
      # map to segment types
      out = SegmentListDict()
      for name, result in zip(channels, result):
          out[name] = SegmentList([Segment(s.gps_start, s.gps_stop) for s in
                                   result.simple_list()])
      return out
docs: Query an NDS2 server for data availability
  
      Parameters
      ----------
      channels : `list` of `str`
          list of channel names to query; this list is mapped to NDS channel
          names using :func:`find_channels`.
  
      start : `int`
          GPS start time of query
  
      end : `int`
          GPS end time of query
  
      connection : `nds2.connection`, optional
          open NDS2 connection to use for query
  
      host : `str`, optional
          name of NDS2 server to query, required if ``connection`` is not
          given
  
      port : `int`, optional
          port number on host to use for NDS2 connection
  
      Returns
      -------
      segdict : `~gwpy.segments.SegmentListDict`
          dict of ``(name, SegmentList)`` pairs
  
      Raises
      ------
      ValueError
          if the given channel name cannot be mapped uniquely to a name
          in the NDS server database.
  
      See also
      --------
      nds2.connection.get_availability
          for documentation on the underlying query method