input: Write a function to parse the given URL and return a tuple containing the protocol, domain name, and path using Python. If the URL is invalid, return None.
  assert parse_url('https://www.example.com/path/to/file')==('https', 'www.example.com', '/path/to/file')
  assert parse_url('http://test.com/subpath')==('http', 'test.com', '/subpath')
  assert parse_url('ftp://user:pass@ftp.example.com/directory')==('ftp', 'user:pass@ftp.example.com', '/directory')
  assert parse_url('invalid_url')==None
  assert parse_url('')==None
output: def parse_url(url):
      try:
          parsed_url = urlparse(url)
          if parsed_url.scheme and parsed_url.netloc:
              return (parsed_url.scheme, parsed_url.netloc, parsed_url.path)
          else:
              return None
      except ValueError:
          return None