input: Write a function to collect all the links from a given website URL using Python. The function should return a list of URLs found in the webpage.
  
  def collect_links(url):
      import requests as req
      from bs4 import BeautifulSoup
      
      # GET request
      r = req.get(url)
      
      # parse the downloaded homepage and grab all text
      soup = BeautifulSoup(r.text, "html.parser")
      
      # find all links and store them in a list
      links = [link.get('href') for link in soup.find_all('a')]
      
      return links
  
  assert collect_links("http://www.example.com/") == [
      'http://www.iana.org/domains/example', 
      'http://www.example.com/about', 
      'http://www.example.com/services'
  ]
  
  assert collect_links("http://www.anothersite.com/") == [
      'http://www.anothersite.com/home', 
      'http://www.anothersite.com/contact', 
      'http://www.anothersite.com/careers'
  ]
  
  assert collect_links("http://www.nosuchsite.com/") == []
  
  assert collect_links("") == []
output: def collect_links(url):
      import requests as req
      from bs4 import BeautifulSoup
      
      try:
          r = req.get(url)
          soup = BeautifulSoup(r.text, "html.parser")
          links = [link.get('href') for link in soup.find_all('a')]
      except:
          links = []
      
      return links