input: Write a python function to fetch data from a given URL and handle HTTPError and URLError exceptions.
  assert fetch_data('http://example.com/api') is not None
  assert fetch_data('http://invalid-url.com') is None
  assert fetch_data('http://another-invalid-url.com') is None
output: def fetch_data(url):
      import urllib.request
      from urllib.error import URLError, HTTPError
  
      try:
          with urllib.request.urlopen(url) as response:
              return response.read()
      except (HTTPError, URLError):
          return None