class PaginationHelper:

    def __init__(self, collection, items_per_page):
        '''The constructor takes in an array of items and a integer indicating
        how many items fit within a single page'''
        self.collection = collection
        '''Given array'''
        self.items_per_page = items_per_page
        '''Given number of items that should be on a single page'''
        self.result = [self.collection[i:i + self.items_per_page]
                  for i in range(0, len(self.collection), self.items_per_page)]
        '''An array that orders our collection'''

    def item_count(self):
        '''Returns the number of items within the entire collection'''
        return len(self.collection)

    def page_count(self):
        '''Returns the number of pages'''
        return m.ceil(len(self.collection) / self.items_per_page)

    def page_item_count(self, page_index):
        '''Returns the number of items on the current page. page_index is zero based.
        This method should return -1 for page_index values that are out of range.'''
        self.page_index = page_index
        try:
            return len(self.result[page_index])
        except IndexError:
            return -1

    def page_index(self, item_index):
        '''Determines what page an item is on. Zero based indexes.
        This method should return -1 for item_index values that are out of range'''
        self.item_index = item_index
        if item_index not in range(len(self.collection)):
            return -1
        item = self.collection[item_index]
        for index, list_of_elements in enumerate(self.result):
            if item in list_of_elements:
                return index
            else:
                continue


collection = [3, 1, 6, 'g', 5, [], (), 0, 'sdf']
helper = PaginationHelper(collection, 2)

print(helper.collection)
print(helper.result)
print(helper.page_index(0))