code: def _chunks(self, l, n):
          
          l.sort()
          newn = int(1.0 * len(l) / n + 0.5)
          for i in range(0, n-1):
              yield l[i*newn:i*newn+newn]
          yield l[n*newn-newn:]
docs: Yield n successive chunks from a list l.