code: def unpack(packet):
      
      validate_packet(packet)
  
      version = packet[0]
      try:
          pyof_lib = PYOF_VERSION_LIBS[version]
      except KeyError:
          raise UnpackException('Version not supported')
  
      try:
          message = pyof_lib.common.utils.unpack_message(packet)
          return message
      except (UnpackException, ValueError) as exception:
          raise UnpackException(exception)
docs: Unpack the OpenFlow Packet and returns a message.
  
      Args:
          packet: buffer with the openflow packet.
  
      Returns:
          GenericMessage: Message unpacked based on openflow packet.
  
      Raises:
          UnpackException: if the packet can't be unpacked.