def METHOD_NAME(doc):
    pages = [random.randint(0, doc.page_count-1) for _ in range(5)]
    boxes = []
    for i in pages:
        page = doc.load_page(i)
        pixmap = page.get_pixmap()
        boxes.append(get_pixmap_bounding_box(pixmap))
    res = boxes[0]
    for box in boxes[1:]:
        res = rect_union(res, box)
    return res