d["__name__"] = k.name()
            return d
        elif isinstance(o, db.Model):
            d = db.to_dict(o)
            k = o.key()
            d["__key__"] = str(k)
            d["__id__"] = k.id()
            d["__name__"] = k.name()
            return d
        elif isinstance(o, (datetime, date, time)):
            # ISO 8601 time, UTC timezone
            return (o).isoformat('T')+'Z'

remote_api_stub.ConfigureRemoteApi(None, REMOTE_API_PATH, auth_func, APP_DOMAIN)

scores_query = Score.all().order("-date")
#scores_query = SecretSalt.all()

cursor = None
batch_has_result = True

# TODO: This isn't terminating when finished
while batch_has_result:
    if cursor:
        scores_query = Score.all().order("-date").with_cursor(cursor)
        #scores_query = SecretSalt.all().with_cursor(cursor)

    batch_has_result = False
    for score in scores_query.run(limit=1000, batch_size=1000):
        batch_has_result = True
        # print db.to_dict(score)
        elif isinstance(o, db.Model):
            d = db.to_dict(o)
            k = o.key()
            d["__key__"] = str(k)
            d["__id__"] = k.id()
            d["__name__"] = k.name()
            return d
        elif isinstance(o, (datetime, date, time)):
            # ISO 8601 time, UTC timezone
            return (o).isoformat('T') + 'Z'


remote_api_stub.ConfigureRemoteApi(None, REMOTE_API_PATH, auth_func,
                                   APP_DOMAIN)

scores_query = Score.all().order("-date")
#scores_query = SecretSalt.all()

cursor = None
batch_has_result = True

# TODO: This isn't terminating when finished
while batch_has_result:
    if cursor:
        scores_query = Score.all().order("-date").with_cursor(cursor)
        #scores_query = SecretSalt.all().with_cursor(cursor)

    batch_has_result = False
    for score in scores_query.run(limit=1000, batch_size=1000):
        batch_has_result = True
        # print db.to_dict(score)