def validate_image(image, number_tiles):
    """Basic sanity checks prior to performing a split."""
    TILE_LIMIT = 99 * 99
    try:
        number_tiles = int(number_tiles)
    except:
        raise ValueError('number_tiles could not be cast to integer.')
    if number_tiles > TILE_LIMIT or number_tiles < 2:
        raise ValueError(
            'Number of tiles must be between 2 and {} (you                           asked for {}).'
            .format(TILE_LIMIT, number_tiles))
