domain +data[pointer:pointer+part_lengthbpointer +part_length part_length data[pointer ip ip_map get(domain 'return domainip def create_response(dataip)ba bytearray packet ba(data[: ]ba([ ]data[ : packet +ba( data[ :packet +ba([ ]for in ip split(')packet append(int( )return packet class dnsprotocol(asyncio datagramprotocol)def connection_made(selftransport)self transport transport def datagram_received(selfdataaddr)print("received request from {}format(addr[ ])domainip lookup_dns(dataprint("sending ip {for {to {}formatdomain decode()ipaddr[ ])self transport sendtocreate_response(dataip)addrloop asyncio get_event_loop(transportprotocol loop run_until_completeloop create_datagram_endpointdnsprotocollocal_addr=( ' ))print("dns server running"with suppress(keyboardinterrupt)loop run_forever(transport close(loop close(