code: def chunk(iterable, size):
      
      # TODO: only used in gui.mainwindow(deprecated)
      iterator = iter(iterable)
      while size:
          result = []
          try:
              for i in range(size):
                  elem = next(iterator)
                  result.append(elem)
              yield tuple(result)
          except StopIteration:
              if result:
                  yield tuple(result)
              return
docs: chunk('ABCDEFG', 3) --> ABC DEF G