def reading_order(e1, e2):
b1 = e1.bbox<EOL>b2 = e2.bbox<EOL>if round(b1[y0]) == round(b2[y0]) or round(b1[y1]) == round(b2[y1]):<EOL><INDENT>return float_cmp(b1[x0], b2[x0])<EOL><DEDENT>return float_cmp(b1[y0], b2[y0])<EOL>
A comparator to sort bboxes from top to bottom, left to right