def open_data_source(source):
if isinstance(source, FILE_LIKE):<EOL><INDENT>source = source.name<EOL><DEDENT>if isinstance(source, CacheEntry):<EOL><INDENT>source = source.path<EOL><DEDENT>if (isinstance(source, string_types) and<EOL>source.endswith(('<STR_LIT>', '<STR_LIT>'))):<EOL><INDENT>return lalframe.FrStreamCacheOpen(lal.CacheImport(source))<EOL><DEDENT>if isinstance(source, list) and is_cache(source):<EOL><INDENT>cache = lal.Cache()<EOL>for entry in file_list(source):<EOL><INDENT>cache = lal.CacheMerge(cache, lal.CacheGlob(*os.path.split(entry)))<EOL><DEDENT>return lalframe.FrStreamCacheOpen(cache)<EOL><DEDENT>if isinstance(source, lal.Cache):<EOL><INDENT>return lalframe.FrStreamCacheOpen(source)<EOL><DEDENT>if isinstance(source, string_types):<EOL><INDENT>return lalframe.FrStreamOpen(*map(str, os.path.split(source)))<EOL><DEDENT>raise ValueError("<STR_LIT>"<EOL>% type(source))<EOL>
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.