code: def pack(chunks, r=32):
      
      if r < 1:
          raise ValueError('pack needs r > 0')
  
      n = shift = 0
  
      for c in chunks:
          n += c << shift
          shift += r
  
      return n
docs: Return integer concatenating integer chunks of r > 0 bit-length.
  
      >>> pack([0, 1, 0, 1, 0, 1], 1)
      42
  
      >>> pack([0, 1], 8)
      256
  
      >>> pack([0, 1], 0)
      Traceback (most recent call last):
          ...
      ValueError: pack needs r > 0