code: def _process_scan_event(self, response):
          
  
          payload = response.payload
          length = len(payload) - 10
  
          if length < 0:
              return
  
          rssi, packet_type, sender, _addr_type, _bond, data = unpack("<bB6sBB%ds" % length, payload)
          string_address = ':'.join([format(x, "02X") for x in bytearray(sender[::-1])])
  
          # Scan data is prepended with a length
          if len(data) > 0:
              data = bytearray(data[1:])
          else:
              data = bytearray([])
  
          self._scan_event_count += 1
  
          # If this is an advertisement packet, see if its an IOTile device
          # packet_type = 4 is scan_response, 0, 2 and 6 are advertisements
          if packet_type in (0, 2, 6):
              if len(data) != 31:
                  return
  
              if data[22] == 0xFF and data[23] == 0xC0 and data[24] == 0x3:
                  self._v1_scan_count += 1
                  self._parse_v1_advertisement(rssi, string_address, data)
              elif data[3] == 27 and data[4] == 0x16 and data[5] == 0xdd and data[6] == 0xfd:
                  self._v2_scan_count += 1
                  self._parse_v2_advertisement(rssi, string_address, data)
              else:
                  pass # This just means the advertisement was from a non-IOTile device
          elif packet_type == 4:
              self._v1_scan_response_count += 1
              self._parse_v1_scan_response(string_address, data)
docs: Parse the BLE advertisement packet.
  
          If it's an IOTile device, parse and add to the scanned devices. Then,
          parse advertisement and determine if it matches V1 or V2.  There are
          two supported type of advertisements:
  
          v1: There is both an advertisement and a scan response (if active scanning
              is enabled).
          v2: There is only an advertisement and no scan response.