def possibly_flip(is_white, neighbors):
    """
    Any black tile with zero or more than 2
    black tiles immediately adjacent to it is flipped to white.
    Any white tile with exactly 2 black tiles
    immediately adjacent to it is flipped to black.
    """
    black_neighbors = sum(not is_white for is_white in neighbors)
    if not is_white:
        if black_neighbors == 0 or black_neighbors > 2:
            return True
    else:
        if black_neighbors == 2:
            return False
    return is_white