code: def page(content, pagecallback=prompt):
      
      width = getwidth()
      height = getheight()
      pagenum = 1
  
      try:
          try:
              line = content.next().rstrip("\r\n")
          except AttributeError:
              # Python 3 compatibility
              line = content.__next__().rstrip("\r\n")
      except StopIteration:
          pagecallback(pagenum)
          return
  
      while True:     # page cycle
          linesleft = height-1 # leave the last line for the prompt callback
          while linesleft:
              linelist = [line[i:i+width] for i in range(0, len(line), width)]
              if not linelist:
                  linelist = ['']
              lines2print = min(len(linelist), linesleft)
              for i in range(lines2print):
                  if WINDOWS and len(line) == width:
                      # avoid extra blank line by skipping linefeed print
                      echo(linelist[i])
                  else:
                      print((linelist[i]))
              linesleft -= lines2print
              linelist = linelist[lines2print:]
  
              if linelist: # prepare symbols left on the line for the next iteration
                  line = ''.join(linelist)
                  continue
              else:
                  try:
                      try:
                          line = content.next().rstrip("\r\n")
                      except AttributeError:
                          # Python 3 compatibility
                          line = content.__next__().rstrip("\r\n")
                  except StopIteration:
                      pagecallback(pagenum)
                      return
          if pagecallback(pagenum) == False:
              return
          pagenum += 1
docs: Output `content`, call `pagecallback` after every page with page
      number as a parameter. `pagecallback` may return False to terminate
      pagination.
  
      Default callback shows prompt, waits for keypress and aborts on
      'q', ESC or Ctrl-C.