input: Write a function to scrape the table from the given URL and extract the planets' information including 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 URL or the table is not found, return an empty list.
  Returns: [{name, mass, distance_from_sun}, ...]
  assert scrape_planets('https://en.wikipedia.org/wiki/List_of_gravitationally_rounded_objects_of_the_Solar_System')
  assert scrape_planets('https://thisurldoesnotexist.com')==[]
output: import requests
  from bs4 import BeautifulSoup
  
  def scrape_planets(url):
      try:
          response = requests.get(url)
          response.raise_for_status()
          soup = BeautifulSoup(response.text, '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 = cols[2].get_text(strip=True)
                  planets.append({'name': name, 'mass': mass, 'distance_from_sun': distance})
          return planets
      except:
          return []