def fetch_content_sample(url: str, media_download_headers: Optional[dict] = None, sample_size=10240):  # 10 KB
    # It's ok to pass None to requests.get() for headers and it won't change the default headers
    """Fetch a sample of the content from the URL.

    Raises:
        HTTPError: If the response status code is not 200
    """
    response = requests.get(url, stream=True, headers=media_download_headers)
    response.raise_for_status()
    buffer = io.BytesIO()
    try:
        # FIXME what is the point of having both sample_size and max chunk size hard coded?
        for chunk in response.iter_content(chunk_size=min(sample_size, 8192)):
            buffer.write(chunk)
            if buffer.tell() >= sample_size:
                break
        buffer.seek(0)
        yield buffer
    finally:
        buffer.close()
        response.close()
Fetch a sample of the content from the URL.

    Raises:
        HTTPError: If the response status code is not 200
    
src/marqo/core/inference/modality_utils.py