text: """ Generation and random coloring of independent line buckets """
  from larlib import *
  
  lines = randomLines(200,0.3)
  VIEW(STRUCT(AA(POLYLINE)(lines)))
  
  boxes = containment2DBoxes(lines)
  buckets = boxBuckets(boxes)
  
  colors = [CYAN, MAGENTA, WHITE, RED, YELLOW, GRAY, GREEN, ORANGE, BLACK, BLUE, PURPLE, BROWN]
  sets = [COLOR(colors[k%12])(STRUCT(AA(POLYLINE)([lines[h] 
              for h in bucket]))) for k,bucket in enumerate(buckets) if bucket!=[]]
  
  VIEW(STRUCT(sets))
  