<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def __query_node(self, ip, host):
        '''
        Query this node.
        Return node details and if we already knew about it or if this is a new node.
        Don't save the node to the known list, just return info about it.

        Args:
            ip:                 IP Address of the node.
            host:               Hostname of this known (if known from CDP/LLDP)

        Returns:
            natlas_node:        Node of this object
            int:                NODE_NEW   = Newly discovered node
                                NODE_NEWIP = Already knew about this node but not by this IP
                                NODE_KNOWN = Already knew about this node
        '''
        host = util.shorten_host_name(host, self.config.host_domains)
        node, node_updated = self.__get_known_node(ip, host)

        if (node == None):
            # new node
            node        = natlas_node()
            node.name   = host
            node.ip     = [ip]
            state       = NODE_NEW
        else:
            # existing node
            if (node.snmpobj.success == 1):
                # we already queried this node successfully - return it
                return (node, NODE_KNOWN)
            # existing node but we couldn't connect before
            if (node_updated == 1):
                state = NODE_NEWIP
            else:
                state = NODE_KNOWN
            node.name = host

        if (ip == 'UNKNOWN'):
            return (node, state)

        # vmware ESX reports the IP as 0.0.0.0
        # LLDP can return an empty string for IPs.
        if ((ip == '0.0.0.0') | (ip == '')):
            return (node, state)

        # find valid credentials for this node
        if (node.try_snmp_creds(self.config.snmp_creds) == 0):
            return (node, state)

        node.name = node.get_system_name(self.config.host_domains)
        if (node.name != host):
            # the hostname changed (cdp/lldp vs snmp)!
            # double check we don't already know about this node
            if (state == NODE_NEW):
                node2, node_updated2 = self.__get_known_node(ip, host)
                if ((node2 != None) & (node_updated2 == 0)):
                    return (node, NODE_KNOWN)
                if (node_updated2 == 1):
                    state = NODE_NEWIP

        # Finally, if we still don't have a name, use the IP.
        # e.g. Maybe CDP/LLDP was empty and we dont have good credentials
        # for this device.  A blank name can break Dot.
        if ((node.name == None) | (node.name == '')):
            node.name = node.get_ipaddr()

        node.opts.get_serial = True     # CDP/LLDP does not report, need for extended ACL
        node.query_node()
        return (node, state)