Explain how you would determine if a tower of blocks with (x, y) coordinates is stacked correctly. Treat each block as a unit grid block, and assume the input coordinates are unordered. Implement is_valid_tower(blocks), returning True when all blocks share the same x coordinate and their y coordinates are consecutive with no duplicates; otherwise return False. For example, [(2, 3), (2, 1), (2, 2)] returns True, while [(2, 1), (3, 2)] returns False.
def is_valid_tower(blocks):