#NEWLINE# def _handle_data( self , data ) : #NEWLINE# #INDENT# response = parse_response ( data ) #NEWLINE# if ( response and response . hostname ) : #NEWLINE# #INDENT# hostname = response . hostname #NEWLINE# ip = None #NEWLINE# for answer in answer . answers : #NEWLINE# #INDENT# if ( ( answer [ 1 ] in ( QTYPE_A , QTYPE_AAAA ) ) and ( answer [ 2 ] == QCLASS_IN ) ) : #NEWLINE# #INDENT# ip = answer [ 0 ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not ip ) and ( self . _hostname_status . get ( hostname , STATUS_IPV6 ) == STATUS_IPV4 ) ) : #NEWLINE# #INDENT# self . _hostname_status [ hostname ] = STATUS_IPV6 #NEWLINE# self . _send_req ( hostname , QTYPE_AAAA ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ip : #NEWLINE# #INDENT# self . _cache [ hostname ] = ip #NEWLINE# self . _call_callback ( hostname , ip ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . _hostname_status . get ( hostname , None ) == STATUS_IPV6 ) : #NEWLINE# #INDENT# for question in response . questions : #NEWLINE# #INDENT# if ( question [ 1 ] == QTYPE_AAAA ) : #NEWLINE# #INDENT# self . _call_callback ( hostname , None ) #NEWLINE# break