input: Write a function to parse the given URL and print out the protocol, domain name, and path. The function should return the parsed protocol, domain name, and path as a tuple. 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://example.com')==('http', 'example.com', '/')
  assert parse_url('ftp://ftp.example.com/file')==('ftp', 'ftp.example.com', '/file')
  assert parse_url('invalid_url')==None
output: def parse_url(url):
      try:
          parsed = urlparse(url)
          if parsed.scheme and parsed.netloc:
              return (parsed.scheme, parsed.netloc, parsed.path if parsed.path else '/')
          else:
              return None
      except:
          return None