input: Write a function that collects all the links from a given URL using Python. The function should return a list of all the links found on the webpage.
  
  def collect_links(url):
      import requests as req 
      from bs4 import BeautifulSoup 
      
      # GET request 
      response = req.get(url) 
      
      # parse the downloaded webpage
      soup = BeautifulSoup(response.text, "html.parser") 
      
      # find all links 
      links = soup.find_all('a') 
      
      # extract and return href attributes
      return [link.get('href') for link in links if link.get('href')]
  
  assert collect_links("http://www.example.com/")==['http://www.iana.org/domains/example']
  assert collect_links("http://www.github.com/")==['https://github.blog', 'https://docs.github.com', 'https://support.github.com', 'https://github.com/about', 'https://github.com/pricing', 'https://enterprise.github.com', 'https://github.com/contact', 'https://github.com/security', 'https://github.com/customer-stories', 'https://github.com/partnered-solutions', 'https://github.com/join', 'https://github.com/login', 'https://github.blog', 'https://docs.github.com', 'https://support.github.com', 'https://github.com/about', 'https://github.com/pricing', 'https://enterprise.github.com', 'https://github.com/contact', 'https://github.com/security', 'https://github.com/customer-stories', 'https://github.com/partnered-solutions', 'https://github.com/enterprise', 'https://github.com/team', 'https://github.com/enterprise', 'https://github.com/team']
  assert collect_links("http://www.nonexistentwebsite.com/")==[]
output: def collect_links(url):
      import requests as req 
      from bs4 import BeautifulSoup 
      
      # GET request 
      response = req.get(url) 
      
      # parse the downloaded webpage
      soup = BeautifulSoup(response.text, "html.parser") 
      
      # find all links 
      links = soup.find_all('a') 
      
      # extract and return href attributes
      return [link.get('href') for link in links if link.get('href')]