code: def blockgen1d(block, size):
      
      def numblock(blk, x):
          """Compute recursively the numeric intervals
  
          """
          a, b = x
          if b - a <= blk:
              return [x]
          else:
              result = []
              d = int(b - a) // 2
              for i in imap(numblock, [blk, blk], [(a, a + d), (a + d, b)]):
                  result.extend(i)
              return result
  
      return [slice(*l) for l in numblock(block, (0, size))]
docs: Compute 1d block intervals to be used by combine.
  
      blockgen1d computes the slices by recursively halving the initial
      interval (0, size) by 2 until its size is lesser or equal than block
  
      :param block: an integer maximum block size
      :param size: original size of the interval, it corresponds to a 0:size slice
      :return: a list of slices
  
      Example:
  
          >>> blockgen1d(512, 1024)
          [slice(0, 512, None), slice(512, 1024, None)]