<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_advertising_data(self, packet_type, data):
 """Set the advertising data for advertisements sent out by this bled112 Args: packet_type (int):
 0 for advertisement, 1 for scan response data (bytearray):
 the data to set """


        payload = struct.pack("<BB%ss" % (len(data)), packet_type, len(data), bytes(data))
        response = self._send_command(6, 9, payload)

        result, = unpack("<H", response.payload)
        if result != 0:
            return False, {'reason': 'Error code from BLED112 setting advertising data', 'code': result}

        return True, None