input: Write a python function to detect and draw rectangles around objects in an image using a pre-trained Haar Cascade classifier.
  assert isinstance(detect_objects("image.jpg", "haarcascade.xml"), list)  # Should return a list of detected objects
  assert all(isinstance(obj, tuple) and len(obj) == 4 for obj in detect_objects("image.jpg", "haarcascade.xml"))  # Each detected object should be a tuple with 4 elements
output: def detect_objects(image_path, cascade_path):
      import cv2
  
      # Load the pre-trained Haar Cascade classifier
      cascade = cv2.CascadeClassifier(cascade_path)
  
      # Read the image
      image = cv2.imread(image_path)
      gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
  
      # Detect objects
      objects = cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5, minSize=(30, 30))
  
      # Draw rectangles around detected objects and prepare the list of detected objects
      detected_objects = []
      for (x, y, w, h) in objects:
          cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 2)
          detected_objects.append((x, y, w, h))
  
      # Save the image with detected objects
      output_path = 'detected_objects.jpg'
      cv2.imwrite(output_path, image)
  
      return detected_objects