code: def _scan_pages_for_same(self, progress_cb=_stub_progress):
          
          progress = 0
          
          # Read page data if unknown - after this page.same will be True or False
          unknown_pages = [page for page in self.page_list if page.same is None]
          if unknown_pages:
              self._enable_read_access()
  
              for page in unknown_pages:
                  if page.cached_estimate_data is not None:
                      data = page.cached_estimate_data
                      offset = len(data)
                  else:
                      data = []
                      offset = 0
                  assert len(page.data) == page.size
                  data.extend(self.flash.target.read_memory_block8(page.addr + offset,
                                                                      page.size - offset))
                  page.same = same(page.data, data)
                  page.cached_estimate_data = None # This data isn't needed anymore.
                  progress += page.get_verify_weight()
              
                  # Update progress
                  if self.sector_erase_weight > 0:
                      progress_cb(float(progress) / float(self.sector_erase_weight))
          
          # If we have to program any pages of a sector, then mark all pages of that sector
          # as needing to be programmed, since the sector will be erased.
          for sector in self.sector_list:
              if sector.are_any_pages_not_same():
                  sector.mark_all_pages_not_same()
          
          return progress
docs: ! @brief Read the full page data to determine if it is unchanged.
          
          When this function exits, the same flag will be set to either True or False for
          every page. In addition, sectors that need at least one page programmed will have
          the same flag set to False for all pages within that sector.