code: def chunked(iterable, n):
  
      
      iterable = iter(iterable)
      while 1:
          t = tuple(islice(iterable, n))
          if t:
              yield t
          else:
              return
docs: Returns chunks of n length of iterable
  
      If len(iterable) % n != 0, then the last chunk will have length
      less than n.
  
      Example:
  
      >>> chunked([1, 2, 3, 4, 5], 2)
      [(1, 2), (3, 4), (5,)]