input: Write a function to crawl a website for a specific type of data and return the extracted data. The function should take a URL and the type of data to crawl as input, and it should return a list of found data elements. If the given website URL is invalid or if no data is found, return an empty list.
  
  def crawl_website_for_data(website, data_to_crawl):
      import requests
      import re
      response = requests.get(website)
      if data_to_crawl == 'phone numbers':
          data_elements = re.findall('\d{3}-\d{3}-\d{4}', response.text)
      else:
          data_elements = []
      return data_elements
  
  assert crawl_website_for_data('www.example.com', 'phone numbers')==['123-456-7890']
  assert crawl_website_for_data('www.example.com', 'emails')==[]
  assert crawl_website_for_data('invalidurl', 'phone numbers')==[]
output: def crawl_website_for_data(website, data_to_crawl):
      import requests
      import re
      try:
          response = requests.get(website)
          if response.status_code != 200:
              return []
      except requests.exceptions.RequestException:
          return []
      
      if data_to_crawl == 'phone numbers':
          data_elements = re.findall(r'\d{3}-\d{3}-\d{4}', response.text)
      elif data_to_crawl == 'emails':
          data_elements = re.findall(r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', response.text)
      else:
          data_elements = []
      
      return data_elements