seq.current = start + consumed
seq.put()
results += list(range(start, start + consumed))
needed -= consumed
if needed == 0:
    return results
raise RuntimeError('Not enough sequence space to allocate %d numbers.' % needed
    )

def get_numbers(needed):
    query = gaetkSequence.all(keys_only=True).filter('active = ', True)
return db.run_in_transaction(_get_numbers_helper, query.fetch(5), needed)
How to implement "autoincrement" on Google AppEngine