code: def open_data_source(source):
      
      if isinstance(source, FILE_LIKE):
          source = source.name
      if isinstance(source, CacheEntry):
          source = source.path
  
      # read cache file
      if (isinstance(source, string_types) and
              source.endswith(('.lcf', '.cache'))):
          return lalframe.FrStreamCacheOpen(lal.CacheImport(source))
  
      # read glue cache object
      if isinstance(source, list) and is_cache(source):
          cache = lal.Cache()
          for entry in file_list(source):
              cache = lal.CacheMerge(cache, lal.CacheGlob(*os.path.split(entry)))
          return lalframe.FrStreamCacheOpen(cache)
  
      # read lal cache object
      if isinstance(source, lal.Cache):
          return lalframe.FrStreamCacheOpen(source)
  
      # read single file
      if isinstance(source, string_types):
          return lalframe.FrStreamOpen(*map(str, os.path.split(source)))
  
      raise ValueError("Don't know how to open data source of type %r"
                       % type(source))
docs: Open a GWF file source into a `lalframe.XLALFrStream` object
  
      Parameters
      ----------
      source : `str`, `file`, `list`
          Data source to read.
  
      Returns
      -------
      stream : `lalframe.FrStream`
          An open `FrStream`.
  
      Raises
      ------
      ValueError
          If the input format cannot be identified.