code: def upload_binary(self, binary, timeout=2, interval=0.1):
          
          block_number = 0
          block_size = self._determine_max_block_size()
  
          for chunk in chunks(binary, block_size):
              try:
                  self.upload_firmware_block(block_number, chunk)
              except CompletionCodeError as e:
                  if e.cc == CC_LONG_DURATION_CMD_IN_PROGRESS:
                      self.wait_for_long_duration_command(
                              constants.CMDID_HPM_UPLOAD_FIRMWARE_BLOCK,
                              timeout, interval)
                  else:
                      raise HpmError('upload_firmware_block CC=0x%02x' % e.cc)
              block_number += 1
              block_number &= 0xff
docs: Upload all firmware blocks from binary and wait for
              long running command.