def scan_storage(self, area_name, callable, start=0, stop=None):
        """Iterate over streaming or storage areas, calling callable.

        Args:
            area_name (str): Either 'storage' or 'streaming' to indicate which
                storage area to scan.
            callable (callable): A function that will be called as (offset, reading)
                for each reading between start_offset and end_offset (inclusive).  If
                the scan function wants to stop early it can return True.  If it returns
                anything else (including False or None), scanning will continue.
            start (int): Optional offset to start at (included in scan).
            stop (int): Optional offset to end at (included in scan).

        Returns:
            int: The number of entries scanned.
        """

        if area_name == u'storage':
            data = self.storage_data
        elif area_name == u'streaming':
            data = self.streaming_data
        else:
            raise ArgumentError("Unknown area name in scan_storage (%s) should be storage or streaming" % area_name)

        if len(data) == 0:
            return 0

        if stop is None:
            stop = len(data) - 1
        elif stop >= len(data):
            raise ArgumentError("Given stop offset is greater than the highest offset supported", length=len(data), stop_offset=stop)

        scanned = 0
        for i in range(start, stop + 1):
            scanned += 1

            should_break = callable(i, data[i])
            if should_break is True:
                break

        return scanned
Iterate over streaming or storage areas, calling callable.

        Args:
            area_name (str): Either 'storage' or 'streaming' to indicate which
                storage area to scan.
            callable (callable): A function that will be called as (offset, reading)
                for each reading between start_offset and end_offset (inclusive).  If
                the scan function wants to stop early it can return True.  If it returns
                anything else (including False or None), scanning will continue.
            start (int): Optional offset to start at (included in scan).
            stop (int): Optional offset to end at (included in scan).

        Returns:
            int: The number of entries scanned.