"""Find the 0-based chunk index that contains the given index.

Args:
    chunks: List of tuples where each tuple contains the begin and end indices of a chunk.
    idx: The index to search for within the chunks.

Returns:
    int: The 0-based index of the chunk that contains the given index.

Raises:
    ValueError: If the index is not found within any of the chunks.
"""
You should write code starting with:
import bisect
from typing import List, Tuple

def find_chunk_index(chunks: List[Tuple[int, int]], idx: int) -> int:
    # TODO: Implement this function
    pass

