@api_view(('<STR_LIT:GET>',))<EOL>def whois_detail(request, address, format=None):
address_obj = None<EOL>try:<EOL><INDENT>address_obj = IPAddress(address)<EOL><DEDENT>except AddrFormatError:<EOL><INDENT>try:<EOL><INDENT>address_obj = EUI(address)<EOL><DEDENT>except AddrFormatError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if not address_obj:<EOL><INDENT>return Response({'<STR_LIT>': '<STR_LIT>'}, status=<NUM_LIT>)<EOL><DEDENT>elif isinstance(address_obj, IPAddress):<EOL><INDENT>try:<EOL><INDENT>ip = Ip.objects.get(address=address)<EOL><DEDENT>except Ip.DoesNotExist:<EOL><INDENT>return Response({'<STR_LIT>': '<STR_LIT>'}, status=<NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>interface = ip.interface<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>interface = Interface.objects.get(mac=address)<EOL><DEDENT>except Interface.DoesNotExist:<EOL><INDENT>return Response({'<STR_LIT>': '<STR_LIT>'}, status=<NUM_LIT>)<EOL><DEDENT><DEDENT>user = interface.device.node.user<EOL>device = interface.device<EOL>data = {<EOL>'<STR_LIT:address>': address,<EOL>'<STR_LIT:user>': user.username,<EOL>'<STR_LIT:name>': user.get_full_name(),<EOL>'<STR_LIT>': device.name,<EOL>'<STR_LIT>': device.node.name<EOL>}<EOL>return Response(data)<EOL>
Retrieve basic whois information related to a layer2 or layer3 network address.