def in_rectangle(pos, rect):
    """Tests if the 2-D point lies in an axis-aligned rectangle, defined
    as a two-element list of arrays [bottom left, top right].
    """
    return all([rect[0][i] <= pos[i] <= rect[1][i] for i in range(2)])