code: def write_flash(self, addr, page_buffer, target_page, page_count):
          
          # print "Write page", flashPage
          # print "Writing page [%d] and [%d] forward" % (flashPage, nPage)
          pk = None
  
          # Flushing downlink ...
          pk = self.link.receive_packet(0)
          while pk is not None:
              pk = self.link.receive_packet(0)
  
          retry_counter = 5
          # print "Flasing to 0x{:X}".format(addr)
          while ((not pk or pk.header != 0xFF or
                  struct.unpack('<BB', pk.data[0:2]) != (addr, 0x18)) and
                 retry_counter >= 0):
              pk = CRTPPacket()
              pk.set_header(0xFF, 0xFF)
              pk.data = struct.pack('<BBHHH', addr, 0x18, page_buffer,
                                    target_page, page_count)
              self.link.send_packet(pk)
              pk = self.link.receive_packet(1)
              retry_counter -= 1
  
          if retry_counter < 0:
              self.error_code = -1
              return False
  
          self.error_code = pk.data[3]
  
          return pk.data[2] == 1
docs: Initiate flashing of data in the buffer to flash.