input: Write a function to parse the given URL and print out the protocol, domain name, and path using Python. The function should return the protocol, domain name, and path in a tuple.
  assert url_parser('https://www.example.com/path/to/file')==('https', 'www.example.com', '/path/to/file')
  assert url_parser('http://sub.domain.com/directory/')==('http', 'sub.domain.com', '/directory/')
  assert url_parser('ftp://user:password@host.com/folder')==('ftp', 'user:password@host.com', '/folder')
  assert url_parser('')==('', '', '')
  assert url_parser('example.com')==('', 'example.com', '')
output: def url_parser(url):
      if not url:
          return ('', '', '')
      protocol_end = url.find('://')
      if protocol_end == -1:
          protocol = ''
          domain_start = 0
      else:
          protocol = url[:protocol_end]
          domain_start = protocol_end + 3
      path_start = url.find('/', domain_start)
      if path_start == -1:
          domain = url[domain_start:]
          path = ''
      else:
          domain = url[domain_start:path_start]
          path = url[path_start:]
      return (protocol, domain, path)