input: Write a function to implement a web scraper in Python that extracts the top ten trending YouTube videos. The function should make a request to YouTube's trending page, parse the content using BeautifulSoup, and then extract and print the titles of the top ten trending videos. If the page content cannot be parsed or if there are fewer than ten trending videos, the function should handle the exception and return an appropriate message.
  
  def extract_top_trending_videos():
      import requests
      from bs4 import BeautifulSoup
  
      # make a request to get the page content
      page = requests.get("https://www.youtube.com/feed/trending")
  
      # parse the page content
      soup = BeautifulSoup(page.content, 'html.parser')
  
      # extract the list of trending videos
      trending_videos = soup.find_all(class_='expanded-shelf-content-item-wrapper')
  
      # check if there are at least ten trending videos
      if len(trending_videos) < 10:
          return "Fewer than ten trending videos found."
  
      # print the top ten trending videos
      for video in trending_videos[:10]:
          print(video.find(class_='yt-uix-tile-link').get('title'))
      
      return "Top ten trending videos extracted successfully."
  
  assert extract_top_trending_videos()=="Top ten trending videos extracted successfully."
output: def extract_top_trending_videos():
      import requests
      from bs4 import BeautifulSoup
  
      try:
          page = requests.get("https://www.youtube.com/feed/trending")
          soup = BeautifulSoup(page.content, 'html.parser')
          trending_videos = soup.find_all(class_='expanded-shelf-content-item-wrapper')
  
          if len(trending_videos) < 10:
              return "Fewer than ten trending videos found."
  
          for video in trending_videos[:10]:
              print(video.find(class_='yt-uix-tile-link').get('title'))
          
          return "Top ten trending videos extracted successfully."
      except Exception as e:
          return f"An error occurred: {e}"