code: def read_cache(cachefile, coltype=LIGOTimeGPS, sort=None, segment=None):
      if not isinstance(cachefile, FILE_LIKE):
          with open(file_path(cachefile), 'r') as fobj:
              return read_cache(fobj, coltype=coltype, sort=sort,
                                segment=segment)
      cache = [x.path for x in _iter_cache(cachefile, gpstype=coltype)]
      if segment:
          cache = sieve(cache, segment=segment)
      if sort:
          cache.sort(key=sort)
      return cache