def horizontal_overlaps(rect, others, sorted=False):
    """Get rects that overlap horizontally with the
    given rect."""
    overlaps = []
    for other in others:
        # Note: can optimise to prevent
        # going through the rest of the
        # array when we hit a non match
        if rect.overlaps_y(other):
            overlaps.append(other)
    return overlaps