def strip_headers_footers_pagebreaks(docbody, page_break_posns,
    num_head_lines, num_foot_lines):
    """Remove page-break lines, header lines, and footer lines from the
       document.
       @param docbody: (list) of strings, whereby each string in the list is a
        line in the document.
       @param page_break_posns: (list) of integers, whereby each integer
        represents the index in docbody at which a page-break is found.
       @param num_head_lines: (int) the number of header lines each page in the
        document has.
       @param num_foot_lines: (int) the number of footer lines each page in the
        document has.
       @return: (list) of strings - the document body after the headers,
        footers, and page-break lines have been stripped from the list.
    """
    num_breaks = len(page_break_posns)
    page_lens = []
    for x in range(0, num_breaks):
        if x < num_breaks - 1:
            page_lens.append(page_break_posns[x + 1] - page_break_posns[x])
    page_lens.sort()
    if len(page_lens) > 0 and num_head_lines + num_foot_lines + 1 < page_lens[0
        ]:
        page_break_posns.reverse()
        first = 1
        for i in range(0, len(page_break_posns)):
            if not first:
                for dummy in range(1, num_head_lines + 1):
                    docbody[page_break_posns[i] + 1:page_break_posns[i] + 2
                        ] = []
            else:
                first = 0
            docbody[page_break_posns[i]:page_break_posns[i] + 1] = []
            if i != len(page_break_posns) - 1:
                for dummy in range(1, num_foot_lines + 1):
                    docbody[page_break_posns[i] - num_foot_lines:
                        page_break_posns[i] - num_foot_lines + 1] = []
    return docbody
