def METHOD_NAME(migration, cursor=None, last_parent=None, stop=False):
    entities, next_cursor, more = migration.query().fetch_page(
        10, start_cursor=cursor, keys_only=migration.keys_only)
    counters = collections.Counter()
    for entity in entities:
        changes = migration.handle_entity(entity)
        counters.update(changes)
    summary = ', '.join('%s: %d' % x for x in sorted(counters.items()))
    if entities:
        logging.info('fetched %d. %s. (%r-%r)',
                     len(entities), summary, entities[0], entities[-1])
    if stop:
        return
    if more and next_cursor:
        deferred.defer(METHOD_NAME, migration, cursor=next_cursor, last_parent=last_parent)