def extend_bounding_box(bounding_box, points):
    """Extend a bounding box to include given points."""
    minx, miny, width, height = bounding_box
    maxx, maxy = (
        -inf if isinf(minx) else minx + width,
        -inf if isinf(miny) else miny + height)
    x_list, y_list = zip(*points)
    minx, miny, maxx, maxy = (
        min(minx, *x_list), min(miny, *y_list),
        max(maxx, *x_list), max(maxy, *y_list))
    return minx, miny, maxx - minx, maxy - miny
Extend a bounding box to include given points.
weasyprint/svg/bounding_box.py