'Get a generator which yields progress information.
The returned generator will yield a series of 5-tuples that specify
progress information about a prior run of the uploader. The 5-tuples
have the following values:
progress_key: The unique key to later update this record with new
progress information.
state: The last state saved for this progress record.
kind: The datastore kind of the items for uploading.
key_start: The starting key of the items for uploading (inclusive).
key_end: The ending key of the items for uploading (inclusive).
After all incompletely-transferred records are provided, then one
more 5-tuple will be generated:
None
DATA_CONSUMED_TO_HERE: A unique string value indicating this record
is being provided.
None
None
key_end: An integer value specifying the last data source key that
was handled by the previous run of the uploader.
The caller should begin uploading records which occur after key_end.
Yields:
Five-tuples of (progress_key, state, kind, key_start, key_end)'

def GetProgressStatusGenerator(self):

    conn = sqlite3.connect(self.db_filename, isolation_level=None)
    cursor = conn.cursor()
    cursor.execute('select    max(key_end)    from    progress')
    result = cursor.fetchone()
    if (result is not None):
        key_end = result[0]
    else:
        logger.debug('No    rows    in    progress    database.')
        return
    self.prior_key_end = key_end
    cursor.execute('select    id,    state,    kind,    key_start,    key_end    from    progress        where    state    !=    ?        order    by    id', (STATE_SENT,))
    rows = cursor.fetchall()
    for row in rows:
        if (row is None):
            break
        (progress_key, state, kind, key_start, key_end) = row
        (yield (progress_key, state, kind, key_start, key_end))
    (yield (None, DATA_CONSUMED_TO_HERE, None, None, key_end))
