def _square_is_okay(rectangle, xval, yval):
    """
    Return true if location is in the rectangle and not used.
    """
    if xval < 0:
        return False
    if yval < 0:
        return False
    if xval >= len(rectangle[0]):
        return False
    if yval >= len(rectangle):
        return False
    if rectangle[yval][xval] != 0:
        return False
    return True