def METHOD_NAME(uri: str, with_progress: bool = True) -> ContextManager:
    """Returns a context manager for a file-like object that supports buffered
    reads. If with_progress is True, wraps the read() method of the object in
    a function that updates a tqdm progress bar.
    Usage:
    .. code-block:: python
        with get_file_obj(uri) as f:
            ...
    Adapted from https://stackoverflow.com/a/63831344/5908685.
    """
    r = requests.get(uri, stream=True, allow_redirects=True)
    if r.status_code != 200:
        r.raise_for_status()  # Will only raise for 4xx codes, so...
        raise RuntimeError(
            f'Request to {uri} returned status code {r.status_code}')
    file_obj = r.raw
    # Decompress if needed
    file_obj.read = partial(file_obj.read, decode_content=True)
    if not with_progress:
        return file_obj
    file_size = int(r.headers.get('Content-Length', 0))
    desc = '(Unknown total file size)' if file_size == 0 else ''
    # put a wrapper around file_obj's read() method that updates the
    # progress bar
    file_obj_wrapped = tqdm.wrapattr(
        file_obj,
        'read',
        total=file_size,
        desc=desc,
        bytes=True,
        mininterval=0.5,
        delay=5)
    return file_obj_wrapped