input: Write a function to scrape an online news website to get the headlines. The function should accept a URL as input and return a list of headlines. Use requests and BeautifulSoup libraries for the task.
  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 a list of headlines
      return [headline.text for headline in headlines]
  
  assert get_headlines("https://www.examplenews.com/")==["Headline 1", "Headline 2", "Headline 3"]
  assert get_headlines("https://www.anothernews.com/")==["News Title 1", "News Title 2"]
  assert get_headlines("https://www.nonnews.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]