input: Write a function to create a web scraper using Python that collects the title and content from the homepage of a given website. The function should take a URL as input and return the title and content as a dictionary. If either the title or content is not found, the function should return None for that particular value.
  
  def web_scraper(url):
      import requests
      import bs4
  
      r = requests.get(url)
      html = bs4.BeautifulSoup(r.text, "html.parser")
  
      title = html.find('title')
      if title:
          title = title.text
      else:
          title = None
  
      content = html.find('div', {'class': 'content'})
      if content:
          content = content.text
      else:
          content = None
  
      return {'title': title, 'content': content}
  
  assert web_scraper('https://www.example.com') == {'title': 'Example Domain', 'content': 'This domain is for use in illustrative examples in documents.'}
  assert web_scraper('https://www.nonexistentwebsite.com') == {'title': None, 'content': None}
output: def web_scraper(url):
      import requests
      import bs4
  
      try:
          r = requests.get(url)
          r.raise_for_status()
          html = bs4.BeautifulSoup(r.text, "html.parser")
  
          title = html.find('title')
          if title:
              title = title.text
          else:
              title = None
  
          content = html.find('div', {'class': 'content'})
          if content:
              content = content.text
          else:
              content = None
  
          return {'title': title, 'content': content}
      except:
          return {'title': None, 'content': None}