input: Write a function to scrape an online news website to get the headlines. The function should take a URL as input, use the requests and BeautifulSoup libraries to fetch and parse the webpage, and return a list of headlines found in <h2> tags. If no headlines are found, the function should return an empty list.
  import requests
  from bs4 import BeautifulSoup 
  
  def get_headlines(url):
      # get the response in the form of html
      r = requests.get(url) 
      
      # create a beautifulsoup object to parse contents 
      soup = BeautifulSoup(r.content, 'html5lib') 
      
      # find headlines from the parsed page  
      headlines = soup.find_all('h2') 
      
      # return the headlines as a list of text
      return [headline.text for headline in headlines]
  
  assert get_headlines("https://www.news.com/")==["Headline 1", "Headline 2"]
  assert get_headlines("https://www.example.com/")==[]
output: def get_headlines(url):
      r = requests.get(url) 
      soup = BeautifulSoup(r.content, 'html5lib') 
      headlines = soup.find_all('h2') 
      return [headline.text for headline in headlines]