input: Write a function named parse_url that takes a URL as input and prints out its protocol, domain name, and path. The function should use the urllib.parse.urlparse method to extract these components. If the input URL is valid, the function should return the protocol, domain name, and path as a tuple. If the input URL is invalid or None, the function should return None.
  
  assert parse_url('https://www.example.com/path/to/file')==('https', 'www.example.com', '/path/to/file')
  assert parse_url('http://invalid-url')==None
  assert parse_url('https://example.org/foo/bar')==('https', 'example.org', '/foo/bar')
  assert parse_url(None)==None
  assert parse_url('')==None
output: def parse_url(url):
      if url is None or url == '':
          return None
      parsed = urllib.parse.urlparse(url)
      if parsed.scheme and parsed.netloc and parsed.path:
          return (parsed.scheme, parsed.netloc, parsed.path)
      return None