def preformat_cache(cache, start=None, end=None):
<EOL>if isinstance(cache, FILE_LIKE + string_types):<EOL><INDENT>return read_cache(cache, sort=file_segment,<EOL>segment=Segment(start, end))<EOL><DEDENT>cache = type(cache)(cache)  <EOL>try:<EOL><INDENT>cache.sort(key=file_segment)  <EOL><DEDENT>except ValueError:<EOL><INDENT>return cache<EOL><DEDENT>if start is None:  <EOL><INDENT>start = file_segment(cache[<NUM_LIT:0>])[<NUM_LIT:0>]<EOL><DEDENT>if end is None:  <EOL><INDENT>end = file_segment(cache[-<NUM_LIT:1>])[-<NUM_LIT:1>]<EOL><DEDENT>return sieve(cache, segment=Segment(start, end))<EOL>
Preprocess a `list` of file paths for reading.

    - read the cache from the file (if necessary)
    - sieve the cache to only include data we need

    Parameters
    ----------
    cache : `list`, `str`
        List of file paths, or path to a LAL-format cache file on disk.

    start : `~gwpy.time.LIGOTimeGPS`, `float`, `str`, optional
        GPS start time of required data, defaults to start of data found;
        any input parseable by `~gwpy.time.to_gps` is fine.

    end : `~gwpy.time.LIGOTimeGPS`, `float`, `str`, optional
        GPS end time of required data, defaults to end of data found;
        any input parseable by `~gwpy.time.to_gps` is fine.

    Returns
    -------
    modcache : `list`
        A parsed, sieved list of paths based on the input arguments.