'Generate a (marker_code, segment_offset) 2-tuple for each marker in
the JPEG *stream*, in the order they occur in the stream.'

def iter_markers(self):

    marker_finder = _MarkerFinder.from_stream(self._stream)
    start = 0
    marker_code = None
    while (marker_code != JPEG_MARKER_CODE.EOI):
        (marker_code, segment_offset) = marker_finder.next(start)
        marker = _MarkerFactory(marker_code, self._stream, segment_offset)
        (yield marker)
        start = (segment_offset + marker.segment_length)
