code: def arp_parse(data):
          
          # Iteratize pkt
          pkt = packet.Packet(data)
          i = iter(pkt)
          eth_pkt = next(i)
          # Ensure it's an ethernet frame.
          assert isinstance(eth_pkt, ethernet.ethernet)
  
          arp_pkt = next(i)
          if not isinstance(arp_pkt, arp.arp):
              raise ARPPacket.ARPUnknownFormat()
  
          if arp_pkt.opcode not in (ARP_REQUEST, ARP_REPLY):
              raise ARPPacket.ARPUnknownFormat(
                  msg='unsupported opcode %d' % arp_pkt.opcode)
  
          if arp_pkt.proto != ETH_TYPE_IP:
              raise ARPPacket.ARPUnknownFormat(
                  msg='unsupported arp ethtype 0x%04x' % arp_pkt.proto)
  
          return arp_pkt
docs: Parse ARP packet, return ARP class from packet library.