input: Write a function to scrape the table at the given URL and extract the planets information (name, mass, and distance from the sun). The function should return a list of dictionaries where each dictionary contains the name, mass, and distance from the sun of a planet. If the table is not found or the information is incomplete, the function should return an empty list.
  assert scrape_planets('https://en.wikipedia.org/wiki/List_of_gravitationally_rounded_objects_of_the_Solar_System')==[{'name': 'Mercury', 'mass': '0.330', 'distance_from_sun': '57.9'}, {'name': 'Venus', 'mass': '4.87', 'distance_from_sun': '108.2'}, {'name': 'Earth', 'mass': '5.97', 'distance_from_sun': '149.6'}, {'name': 'Mars', 'mass': '0.642', 'distance_from_sun': '227.9'}, {'name': 'Jupiter', 'mass': '1898', 'distance_from_sun': '778.5'}, {'name': 'Saturn', 'mass': '568', 'distance_from_sun': '1432.0'}, {'name': 'Uranus', 'mass': '86.8', 'distance_from_sun': '2867.0'}, {'name': 'Neptune', 'mass': '102', 'distance_from_sun': '4515.0'}]
  assert scrape_planets('https://example.com/nonexistent')==[]
output: 
  import requests
  from bs4 import BeautifulSoup
  
  def scrape_planets(url):
      try:
          response = requests.get(url)
          soup = BeautifulSoup(response.content, 'html.parser')
          table = soup.find('table', {'class': 'wikitable'})
          if not table:
              return []
          rows = table.find_all('tr')
          planets = []
          for row in rows[1:]:
              cols = row.find_all('td')
              if len(cols) >= 3:
                  name = cols[0].get_text(strip=True)
                  mass = cols[1].get_text(strip=True)
                  distance_from_sun = cols[2].get_text(strip=True)
                  planets.append({'name': name, 'mass': mass, 'distance_from_sun': distance_from_sun})
          return planets
      except:
          return []
  