nodes: 0, module; 1, function_definition; 2, function_name:column_order; 3, parameters; 4, block; 5, identifier:b1; 6, identifier:b2; 7, expression_statement; 8, expression_statement; 9, comment:# TODO(senwu): Reimplement the functionality of this comparator to; 10, comment:# detect the number of columns, and sort those in reading order.; 11, comment:# TODO: This is just a simple top to bottom, left to right comparator; 12, comment:# for now.; 13, if_statement; 14, return_statement; 15, comment:"""
      A comparator that sorts bboxes first by "columns", where a column is made
      up of all bboxes that overlap, then by vertical position in each column.
  
      b1 = [b1.type, b1.top, b1.left, b1.bottom, b1.right]
      b2 = [b2.type, b2.top, b2.left, b2.bottom, b2.right]
      """; 16, assignment; 17, boolean_operator; 18, block; 19, call; 20, tuple_pattern; 21, tuple; 22, comparison_operator:round(b1[top]) == round(b2[top]); 23, comparison_operator:round(b1[bottom]) == round(b2[bottom]); 24, return_statement; 25, identifier:float_cmp; 26, argument_list; 27, identifier:top; 28, identifier:left; 29, identifier:bottom; 30, integer:1; 31, integer:2; 32, integer:3; 33, call; 34, call; 35, call; 36, call; 37, call; 38, subscript; 39, subscript; 40, identifier:round; 41, argument_list; 42, identifier:round; 43, argument_list; 44, identifier:round; 45, argument_list; 46, identifier:round; 47, argument_list; 48, identifier:float_cmp; 49, argument_list; 50, identifier:b1; 51, identifier:top; 52, identifier:b2; 53, identifier:top; 54, subscript; 55, subscript; 56, subscript; 57, subscript; 58, subscript; 59, subscript; 60, identifier:b1; 61, identifier:top; 62, identifier:b2; 63, identifier:top; 64, identifier:b1; 65, identifier:bottom; 66, identifier:b2; 67, identifier:bottom; 68, identifier:b1; 69, identifier:left; 70, identifier:b2; 71, identifier:left
code: def column_order(b1, b2):
      """
      A comparator that sorts bboxes first by "columns", where a column is made
      up of all bboxes that overlap, then by vertical position in each column.
  
      b1 = [b1.type, b1.top, b1.left, b1.bottom, b1.right]
      b2 = [b2.type, b2.top, b2.left, b2.bottom, b2.right]
      """
      (top, left, bottom) = (1, 2, 3)
      # TODO(senwu): Reimplement the functionality of this comparator to
      # detect the number of columns, and sort those in reading order.
  
      # TODO: This is just a simple top to bottom, left to right comparator
      # for now.
      if round(b1[top]) == round(b2[top]) or round(b1[bottom]) == round(b2[bottom]):
          return float_cmp(b1[left], b2[left])
      return float_cmp(b1[top], b2[top])