def fetch_losc_data(detector, start, end, cls=TimeSeries, **kwargs):
<EOL>start = to_gps(start)<EOL>end = to_gps(end)<EOL>span = Segment(start, end)<EOL>kwargs.update({<EOL>'<STR_LIT:start>': start,<EOL>'<STR_LIT:end>': end,<EOL>})<EOL>url_kw = {key: kwargs.pop(key) for key in GWOSC_LOCATE_KWARGS if<EOL>key in kwargs}<EOL>if '<STR_LIT>' in url_kw:  <EOL><INDENT>url_kw['<STR_LIT>'] = Quantity(url_kw['<STR_LIT>'], '<STR_LIT>').value<EOL><DEDENT>cache = get_urls(detector, int(start), int(ceil(end)), **url_kw)<EOL>if len(cache) and _overlapping(cache):<EOL><INDENT>cache.sort(key=lambda x: abs(file_segment(x)))<EOL>for url in cache:<EOL><INDENT>a, b = file_segment(url)<EOL>if a <= start and b >= end:<EOL><INDENT>cache = [url]<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if kwargs.get('<STR_LIT>', False):  <EOL><INDENT>host = urlparse(cache[<NUM_LIT:0>]).netloc<EOL>print("<STR_LIT>".format(<EOL>len(cache), host, int(start), int(ceil(end))))<EOL><DEDENT>is_gwf = cache[<NUM_LIT:0>].endswith('<STR_LIT>')<EOL>if is_gwf and len(cache):<EOL><INDENT>args = (kwargs.pop('<STR_LIT>', None),)<EOL><DEDENT>else:<EOL><INDENT>args = ()<EOL><DEDENT>out = None<EOL>kwargs['<STR_LIT>'] = cls<EOL>for url in cache:<EOL><INDENT>keep = file_segment(url) & span<EOL>new = _fetch_losc_data_file(url, *args, **kwargs).crop(<EOL>*keep, copy=False)<EOL>if is_gwf and (not args or args[<NUM_LIT:0>] is None):<EOL><INDENT>args = (new.name,)<EOL><DEDENT>if out is None:<EOL><INDENT>out = new.copy()<EOL><DEDENT>else:<EOL><INDENT>out.append(new, resize=True)<EOL><DEDENT><DEDENT>return out<EOL>
Fetch LOSC data for a given detector

    This function is for internal purposes only, all users should instead
    use the interface provided by `TimeSeries.fetch_open_data` (and similar
    for `StateVector.fetch_open_data`).