def bounding_box_g(svg, node, font_size):
    """Bounding box for g node."""
    bounding_box = EMPTY_BOUNDING_BOX
    for child in node:
        child_bounding_box = svg.calculate_bounding_box(child, font_size)
        if is_valid_bounding_box(child_bounding_box):
            minx, miny, width, height = child_bounding_box
            maxx, maxy = minx + width, miny + height
            bounding_box = extend_bounding_box(
                bounding_box, ((minx, miny), (maxx, maxy)))
    return bounding_box
Bounding box for g node.
weasyprint/svg/bounding_box.py