<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def page_data(self, idx, offset):
 """ Return character data for page of given index and offset. :param idx: page index. :type idx: int :param offset: scrolling region offset of current page. :type offset: int :returns: list of tuples in form of ``(ucs, name)`` :rtype: list[(unicode, unicode)] """

        size = self.screen.page_size

        while offset < 0 and idx:
            offset += size
            idx -= 1
        offset = max(0, offset)

        while offset >= size:
            offset -= size
            idx += 1

        if idx == self.last_page:
            offset = 0
        idx = min(max(0, idx), self.last_page)

        start = (idx * self.screen.page_size) + offset
        end = start + self.screen.page_size
        return (idx, offset), self._page_data[start:end]