input: Write a python function to preprocess text data by removing non-alphanumeric characters and extra spaces.
  assert preprocess_text("Hello, World!") == "hello world"
  assert preprocess_text("Python 3.8 is awesome!!!") == "python 3 8 is awesome"
  assert preprocess_text("  Leading and trailing spaces   ") == "leading and trailing spaces"
output: def preprocess_text(text):
      import re
      # Remove non-alphanumeric characters except spaces
      text = re.sub(r'[^a-zA-Z0-9\s]', '', text)
      # Convert to lowercase
      text = text.lower()
      # Remove extra spaces
      text = re.sub(r'\s+', ' ', text).strip()
      return text