code: def split_authority(authority):
      
      if '@' in authority:
          userinfo, hostport = authority.split('@', 1)
      else:
          userinfo, hostport = None, authority
      if userinfo and ':' in userinfo:
          user, passwd = userinfo.split(':', 1)
      else:
          user, passwd = userinfo, None
      if hostport and ':' in hostport:
          host, port = hostport.split(':', 1)
      else:
          host, port = hostport, None
      if not host:
          host = None
      return (user, passwd, host, port)
docs: Basic authority parser that splits authority into component parts
  
         >>> split_authority("user:password@host:port")
         ('user', 'password', 'host', 'port')