input: Write a python function to extract emails from a website using BeautifulSoup.
  assert extract_emails('www.example.com')==['email1@example.com', 'email2@example.com']
  assert extract_emails('www.sample.com')==['contact@sample.com', 'info@sample.com']
  assert extract_emails('www.testsite.com')==['admin@testsite.com', 'support@testsite.com']
output: def extract_emails(url):
      import requests
      from bs4 import BeautifulSoup
      import re
  
      response = requests.get(url)
      soup = BeautifulSoup(response.text, 'html.parser')
      emails = set()
  
      for a in soup.find_all('a', href=True):
          if 'mailto:' in a['href']:
              emails.add(a['href'].replace('mailto:', ''))
  
      email_regex = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
      emails.update(re.findall(email_regex, soup.text))
  
      return list(emails)