<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_pocketmod_pages(elements, page_edge_bottom=True, first_page_vertical=True):
 """ Creates one or more managers that wraps the given elements into one or more Pocket Mod-style page sets. Each manager in the list that is returned corresponds to one page. This imposer is designed to work with portrait oriented content pages, laid out onto a landscape oriented page. Arguments: ``elements`` The elements to lay out. PocketMod uses sheets with 8 pages on them, but you can pass in fewer elements - additional space will be left blank. The number of pages output is just the ceiling of the number of pages passed in divided by 8. ``page_edge_bottom`` If true the pages should be arranged so that, when folded, the bottom of each page touches the edge of the sheet of paper. This is normal, because the edge of the paper is where a normal printer blank-margin is located, and the bottom edge of a page usually has the largest margin. ``first_page_vertical`` If true then the fold on the first page will be vertical. Each 'page' in the book has either a fold on the outside edge or on one of the two horizontal edges (the top edge if page_edge_bottom is set, the bottom otherwise). The horizontal fold keeps the page together more strongly, so is normally used for the first page. The original Pocket Mod software has the first page with a horizontal fold. The returned page layouts can be given to a PageLM for rendering onto individual pages of output. This method isn't a layout manager in its own right. """

    pages = {
        (False, False):[2,3,4,5,1,8,7,6],
        (False, True):[4,5,6,7,3,2,1,8],
        (True, False):[5,4,3,2,6,7,8,1],
        (True, True):[7,6,5,4,8,1,2,3]
        }[page_edge_bottom, first_page_vertical]
    output = []
    num_pages = len(elements)
    for index in range(0, num_pages, 8):
        sglm = grid.SimpleGridLM(4, 2)

        for cell_index, cell in enumerate(pages):
            if index + cell - 1 < num_pages:
                element = elements[index+cell-1]
                if (cell_index > 3) != page_edge_bottom:
                    element = transform.RotateLM(2, element)
                sglm.add_element(element)
            else:
                sglm.add_element(None)
        output.append(sglm)
    return output