def collect_table_content(table_bboxes, elems):
    """
    Returns a list of elements that are contained inside
    the corresponding supplied bbox.
    """
    # list of table content chars
    table_contents = [[] for _ in range(len(table_bboxes))]
    prev_content = None
    prev_bbox = None
    for cid, c in enumerate(elems):
        # Annotations should not fall outside alone
        if isinstance(c, LTAnno):
            if prev_content is not None:
                prev_content.append(c)
            continue
        # Generally speaking table contents should be included sequentially
        # and we can avoid checking all tables for elems inside
        # Elements only need to intersect the bbox for table as some
        # formatting of fonts may result in slightly out of bbox text
        if prev_bbox is not None and intersect(prev_bbox, c.bbox):
            prev_content.append(c)
            continue
        # Search the rest of the tables for membership when done with
        # the current one
        for table_id, table_bbox in enumerate(table_bboxes):
            if intersect(table_bbox, c.bbox):
                prev_bbox = table_bbox
                prev_content = table_contents[table_id]
                prev_content.append(c)
                break
    return table_contents
Returns a list of elements that are contained inside
    the corresponding supplied bbox.