def METHOD_NAME(
    lines: Iterable["CheckoutLineInfo"],
    variant_stock_map: dict[
        tuple[
            VARIANT_ID,
            CHANNEL_SLUG,
            COUNTRY_CODE,
        ],
        Iterable[Stock],
    ],
    country_code: str,
) -> list[Tuple["CheckoutLineInfo", int]]:
    """Return checkout lines with insufficient stock."""
    variant_to_quantity_map: dict[int, int] = defaultdict(int)
    variant_to_available_quantity_map: dict[int, int] = defaultdict(int)
    for line_info in lines:
        variant_to_quantity_map[line_info.variant.id] += line_info.line.quantity
        variant_stocks = variant_stock_map.get(
            (line_info.variant.id, line_info.channel.slug, country_code), []
        )
        variant_to_available_quantity_map[line_info.variant.id] = sum(
            [
                stock.available_quantity  # type: ignore[attr-defined]
                for stock in variant_stocks
            ]
        )
    insufficient_stocks = []
    for line_info in lines:
        if not line_info.variant.track_inventory:
            continue
        quantity = variant_to_quantity_map[line_info.variant.id]
        available_quantity = variant_to_available_quantity_map[line_info.variant.id]
        if available_quantity < quantity:
            insufficient_stocks.append((line_info, available_quantity))
    return insufficient_stocks