input: Write a function to build and compile a convolutional neural network using TensorFlow for binary image classification.
  assert isinstance(build_and_compile_model().summary(), str)
  assert build_and_compile_model().layers[0].input_shape == (None, 150, 150, 3)
  assert len(build_and_compile_model().layers) == 9
output: def build_and_compile_model():
      import tensorflow as tf
      from tensorflow.keras import layers, models
  
      model = models.Sequential()
      model.add(layers.Input(shape=(150, 150, 3)))
      model.add(layers.Conv2D(32, (3, 3), activation='relu'))
      model.add(layers.MaxPooling2D((2, 2)))
      model.add(layers.Conv2D(64, (3, 3), activation='relu'))
      model.add(layers.MaxPooling2D((2, 2)))
      model.add(layers.Conv2D(128, (3, 3), activation='relu'))
      model.add(layers.MaxPooling2D((2, 2)))
      model.add(layers.Flatten())
      model.add(layers.Dense(512, activation='relu'))
      model.add(layers.Dense(1, activation='sigmoid'))
  
      model.compile(optimizer='adam',
                    loss='binary_crossentropy',
                    metrics=['accuracy'])
  
      return model