code: def _compute_chip_erase_pages_and_weight(self):
          
          chip_erase_count = 0
          chip_erase_weight = 0
          chip_erase_weight += self.flash.get_flash_info().erase_weight
          for page in self.page_list:
              if page.erased is None:
                  page.erased = self.flash.region.is_erased(page.data)
              if not page.erased:
                  chip_erase_count += 1
                  chip_erase_weight += page.get_program_weight()
          self.chip_erase_count = chip_erase_count
          self.chip_erase_weight = chip_erase_weight
          return chip_erase_count, chip_erase_weight
docs: ! @brief Compute the number of erased pages.
  
          Determine how many pages in the new data are already erased.