input: Write a function to generate a deep learning model using Keras that can distinguish between images of cats and dogs. The function should return the compiled model and handle the data preprocessing.
  assert distinguish_cats_and_dogs('/path/to/dataset') is not None
  assert distinguish_cats_and_dogs('/path/to/dataset').compile.called_with(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  assert distinguish_cats_and_dogs('/path/to/dataset').fit_generator.called_with(generator=train_generator, steps_per_epoch=800, epochs=5, validation_data=test_generator, validation_steps=200)
output: def distinguish_cats_and_dogs(dataset_path):
      from tensorflow.keras.models import Sequential
      from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense
      from tensorflow.keras.preprocessing.image import ImageDataGenerator
  
      train_datagen = ImageDataGenerator(rescale=1./255, shear_range=0.2, zoom_range=0.2, horizontal_flip=True)
      test_datagen = ImageDataGenerator(rescale=1./255)
  
      train_generator = train_datagen.flow_from_directory(
          dataset_path + '/train',
          target_size=(150, 150),
          batch_size=32,
          class_mode='binary'
      )
  
      test_generator = test_datagen.flow_from_directory(
          dataset_path + '/test',
          target_size=(150, 150),
          batch_size=32,
          class_mode='binary'
      )
  
      model = Sequential()
      model.add(Conv2D(32, (3, 3), activation='relu', input_shape=(150, 150, 3)))
      model.add(MaxPooling2D(pool_size=(2, 2)))
      model.add(Conv2D(64, (3, 3), activation='relu'))
      model.add(MaxPooling2D(pool_size=(2, 2)))
      model.add(Conv2D(128, (3, 3), activation='relu'))
      model.add(MaxPooling2D(pool_size=(2, 2)))
      model.add(Flatten())
      model.add(Dense(512, activation='relu'))
      model.add(Dense(1, activation='sigmoid'))
  
      model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
      return model